Bread:...gleton(3pm)
π Bread::Board::LifeCycle::Singleton π
okay bestie so this is a page from the User Contributed Perl Documentation and it's literally about a tiny little role called Bread::Board::LifeCycle::Singleton β say that five times fast, I dare you π«Ά
β¨ NAME β¨
Bread::Board::LifeCycle::Singleton β it's the service role for singleton lifecycle. that's the whole vibe. one job, does it flawlessly, queen behavior π
πΈ VERSION πΈ
this is version 0.37 π
π¦ DESCRIPTION π¦
so this role is a sub-role of Bread::Board::LifeCycle (yes it has a parent, we love a family tree), and what it does is define the "singleton" lifecycle for a service.
and what does singleton mean, you ask? it means the get method will only do its actual work the first time it's invoked. every single time after that? subsequent invocations just hand you back the same object. same one. identical. it's giving "I already did this, I'm not doing it again" and honestly? relatable πβ¨
π ATTRIBUTES π
π "instance"
this is the object that got built by the last call to get that actually did any work. and it's also what gets returned by any subsequent call to get. it just sits there, being the one and only, main character energy fr fr π
π METHODS π
β "get"
the first time this gets called β or the first time after you call "flush_instance" β the actual real get method gets invoked, and its return value gets cached in the instance attribute. and then the value of that attribute is always what gets returned.
so like, call get as many times as you need, bestie. go off. you will always, always receive the same instance. no cap π
β "has_instance"
predicate for the "instance" attribute. yep that's it, it just checks if the thing exists π«Ά
β "flush_instance"
clearer for the "instance" attribute. and clearing the attribute will cause the next call to get to instantiate a brand new object. so like... be aware you're wiping the slate, okay? fresh start, new instance, new era β¨
π AUTHOR π
Stevan Little <stevan@iinteractive.com> β absolute icon, thank you for your service π«‘π
π BUGS π
found a bug? got a feature request? please please report it on the bugtracker website:
https://github.com/stevan/BreadBoard/issues
and when you submit a bug or a request, please include a test-file or a patch to an existing test-file that illustrates the bug or the feature you want. like, show us the receipts, not just vibes π
π COPYRIGHT AND LICENSE π
this software is copyright (c) 2019, 2017, 2016, 2015, 2014, 2013, 2011, 2009 by Infinity Interactive.
this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay π
okay that's the whole page, you made it to the end, I'm so proud of you π₯Ή
and just so you have it β this page came from perl v5.36.0, dated 2022-12-12. byeee, go build something iconic πβ¨π¦
π¦ where this page comes from
- debian bookworm: libbread-board-perl 0.37-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libbread-board-perl 0.37-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libbread-board-perl 0.37-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu questing: libbread-board-perl 0.37-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms