Class:...:Lvalue(3pm)
π Class::Accessor::Lvalue β the perl manual, but make it cute β¨
okay so bestie, this is Class:...:Lvalue(3pm) from the User Contributed Perl Documentation, and yes the module's actual name is Class::Accessor::Lvalue π
(the header's just being dramatic with the abbreviation). We're gonna get you lvalue accessors and you're gonna thrive.
β¨ NAME β¨
Class::Accessor::Lvalue β create Lvalue accessors π
πΈ SYNOPSIS πΈ
package Foo;
use base qw( Class::Accessor::Lvalue );
__PACKAGE__->mk_accessors(qw( bar ))
my $foo = Foo->new;
$foo->bar = 42;
print $foo->bar; # prints 42
likeβ¦ you literally just assign to it. no ->bar(42) nonsense. it's giving direct assignment. it's giving main character energy. π¦
π DESCRIPTION π
This module subclasses Class::Accessor so it can hand you lvalue accessor makers. That's the whole vibe. It takes what Class::Accessor already does and makes the accessors assignable, no cap. β¨
π CAVEATS π
bestie listen, read this part, it's important:
- Though
Class::Accessormutators allow for the setting of multiple values to an attribute, the mutators that this module creates handle single scalar values only. Not the end of the world though β this should not be too much of a hinderance, because you can still explicitly use an anonymous array. π - Due to the hoops we have to jump through to preserve the
Class::Accessor->getand->setbehaviour, this module is potentially slow. π
If you don't actually need the flexibility that the->getand->setmethods grant you, it's highly reccomended that you useClass::Accessor::Lvalue::Fastinstead β it's simpler and much faster. fr fr, go look at it. π₯
π AUTHOR π
Richard Clamp <richardc@unixbeard.net> β with many thanks to Yuval Kogman for helping with the groovy lvalue tie magic used in the main class. π§ the tie magic is genuinely iconic, we owe Yuval one.
π COPYRIGHT π
Copyright (C) 2003 Richard Clamp. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π
β SEE ALSO β
Class::AccessorClass::Accessor::Lvalue::Fast
and that's the whole page, bestie π«Ά this one's from perl v5.34.0, dated 2022-06-10, filed under Class:...:Lvalue(3pm) in the User Contributed Perl Documentation. go forth and assign directly, you absolute legend π
β¨
π¦ where this page comes from
- debian bookworm: libclass-accessor-lvalue-perl 0.11-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libclass-accessor-lvalue-perl 0.11-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libclass-accessor-lvalue-perl 0.11-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libclass-accessor-lvalue-perl 0.11-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libclass-accessor-lvalue-perl 0.11-5 Β· 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