Bread:...Service(3pm)
π Bread::Board::Service β bestie edition π
okay so this is the Bread::Board::Service page from the User Contributed Perl Documentation (that's the manual name, it's giving 3pm energy β¨). Sit down, grab a strawberry π, we're learning.
πΈ NAME πΈ
Bread::Board::Service β the Base service role, periodt. It's the blueprint every service in the family is built on π
β¨ VERSION β¨
version 0.37 β no cap, that's the number π
π DESCRIPTION π
This role is the basis for all services in Bread::Board. Think of it as the main character that everyone else takes after. It provides β or requires you to implement β the absolute minimum necessary building blocks, which are:
- creating an instance π£
- setting/getting parameters π
- instance lifecycle π
That's it, that's the whole vibe.
π¦ ATTRIBUTES π¦
"name"
Read/write string, required β οΈ. Every single service needs a name, bestie. It's how you reference the service when you're fetching it. No name = no entry, sorry π«
"is_locked"
Boolean, defaults to false. This one is used during dependency resolution to detect loops π. It's the vibe check that catches circular nonsense.
"lifecycle"
$service->lifecycle('Singleton');
Read/write string. It should be either a partial class name under the Bread::Board::LifeCycle:: namespace (like Singleton for Bread::Board::LifeCycle::Singleton) or a full class name prefixed with a + (like +My::Special::Lifecycle). The name is expected to refer to a loadable role, which will be applied to the service instance. slay π«
π₯ METHODS π₯
"lock"
Locks the service. You should never need to call this method in normal code π. It's giving internal-business-only.
"unlock"
Unlocks the service. Same deal β you should never need to call this method in normal code π. Hands off, bestie.
"get"
my $value = $service->get();
This method must be implemented by the consuming class π. It's expected to instantiate whatever object or value this service should resolve to. You're on your own for this one, queen.
"init_params"
Builder for the service parameters. Defaults to returning an empty hashref {} πͺ£
"clear_params"
Clearer of the service parameters. Bye bye params π
"param"
my @param_names = $service->param();
my $param_value = $service->param($param_name);
$service->param($name1=>$value1,$name2=>$value2);
Getter/setter for the service parameters. Notice β and this is the important part β that calling this method with no arguments returns the list of parameter names π
Please note: these are not the same as the parameters for a parametric service (although those will be copied here beforegetis called), and they are also not the same thing as dependencies (although the resolved dependencies will be copied here beforegetis called). Like, they're cousins, not twins π§
"clone_and_inherit_params"
When you're declaring a service using the service helper function, if the name you use starts with a +, the service definition will extend an existing service with the given name (the one without the +). This method implements the extension semantics: the "dependencies" and "parameters" options get merged with the existing values, rather than overridden π«Ά
π AUTHOR π
Stevan Little <stevan@iinteractive.com> β icon behavior, honestly π
π BUGS π
Please report any bugs or feature requests on the bugtracker website:
https://github.com/stevan/BreadBoard/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature πβ¨. Fr fr, this makes it so much easier for everyone.
π 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 πͺ
SEE ALSO vibes were light on this one, but the whole Bread::Board family is out there waiting for you π
and that's the whole page, bestie π generated from perl v5.36.0, dated 2022-12-12, brought to you by the Bread:...Service(3pm) era of the User Contributed Perl Documentation. go forth and build services π
πβ¨
π¦ 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