MooX::...::Util(3pm)
π MooX::...::Util β the whole vibe π
okay so bestie, welcome to the MooX::...::Util(3pm) page πΈ this is the little corner of the docs where the extra-goodies live, and honestly? it's giving "short but iconic." let's get into it π«Ά
β¨ NAME β¨
MooX::Struct::Util</purpose> β the extensions for MooX::Struct that would've been overkill to include in the main thing π like, they're cute, they're useful, but cramming them into the core package would've been doing the most. so they live here instead π
π LAZY DEFAULTS π
okay this is the main character of the whole page: sugar for lazily defaulted attributes π
and the way that the following two snippets are effectively the same?? literally identical behaviour, two different fits π
fit number one β the long way, writing it all out by hand:
use MooX::Struct WebPage1 => [
user_agent => [
lazy => 1,
default => sub { LWP::UserAgent->new },
],
];
fit number two β the glow-up, using lazy_default from this very module:
use MooX::Struct::Util qw(lazy_default);
use MooX::Struct WebPage2 => [
user_agent => lazy_default { LWP::UserAgent->new },
];
see what happened there?? you imported lazy_default, and suddenly lazy => 1 plus default => sub { ... } collapses into one lil lazy_default { ... } block β¨ same result, way less typing, no cap. obsessed fr fr π
π BUGS π
found something cursed?? π please report any bugs to <http://rt.cpan.org/Dist/Display.html?Queue=MooX-Struct> β that's the queue, that's where the fix happens, go be a hero π¦
π SEE ALSO π
MooX::Structβ the main character that this whole page is vibing alongside π
π AUTHOR π
Toby Inkster <tobyink@cpan.org> β the icon who wrote all of this π
π COPYRIGHT AND LICENCE π
this software is copyright (c) 2012-2013, 2017-2018 by Toby Inkster π
and it's free software bestie β you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself π so go wild (respectfully)
β οΈ DISCLAIMER OF WARRANTIES β οΈ
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
like, no promises, no safety net, it is what it is π read that one twice fr
and that's the whole page, bestie π«Ά this was MooX::...::Util(3pm), documented for perl v5.36.0 and dated 2022-12-12 β go forth and lazily default your attributes, you've got this πβ¨π
π¦ where this page comes from
- debian bookworm: libmoox-struct-perl 0.020-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libmoox-struct-perl 0.020-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libmoox-struct-perl 0.020-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu questing: libmoox-struct-perl 0.020-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms