Mason:...ributes(3pm)
π Mason::Plugin::LvalueAttributes β like, the whole vibe
okay bestie, so this is a page from the User Contributed Perl Documentation for Mason::Plugin::LvalueAttributes (yes that's the manual name, it's giving 3pm section energy, we move). And what does it do?? It creates lvalue accessors for every rw component attribute. Slay.
β¨ SYNOPSIS β¨
<%class>
has 'a' => (is => "rw")
has 'b' => (is => "ro")
</%class>
<%init>
# set a to 5
$.a = 5;
# set a to 6
$.a(6);
# error
$.b = 7;
</%init>
like. look at that. $.a = 5?? iconic behavior, no notes. π
π¦ DESCRIPTION π¦
So this plugin creates an Lvalue accessor for every single read/write attribute in the component. Which means instead of writing this kinda clunky thing:
$.name( "Foo" );
you get to use the way more natural syntax:
$.name = "Foo";
it's giving effortless. it's giving main character. π
π WARNING π (read this one fr fr)
Standard Moose setter features like type checking, triggers, and coercion? Yeah, those will not work on Lvalue attributes. nope. gone. not invited to the party. π
So you should only use this plugin when the convenience of the Lvalue attributes outweighs the need for setter features. Like, if you need your setters to do their little tricks, this plugin is not the one, bestie. vibe check accordingly. π«Ά
πΈ ACKNOWLEDGEMENTS πΈ
Inspired by Christopher Brown's MooseX::Meta::Attribute::Lvalue. credit where credit is due, we love a muse. β¨
π SEE ALSO π
Mason
(go read it, iykyk π)
π§ AUTHOR π§
Jonathan Swartz <swartz@pobox.com> β legend behavior honestly.
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2012 by Jonathan Swartz.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
and that's the whole page, bestie!! π this one was documented for perl v5.34.0 and dated 2022-05-27, which is lowkey ancient but she still eats. mwah π β¨
π¦ where this page comes from
- debian bookworm: libmason-perl 2.24-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libmason-perl 2.24-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libmason-perl 2.24-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libmason-perl 2.24-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmason-perl 2.24-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms