MooseX...::Fast(3pm)
π MooseX::Emulate::Class::Accessor::Fast β the manual page, but make it cute π
perl v5.36.0 Β· User Contributed Perl Documentation Β· MooseX...::Fast(3pm)
okay bestie, sit down, hydrate, because we're doing MooseX::Emulate::Class::Accessor::Fast and honestly? it's giving glow-up arc. π¦
β¨ NAME β¨
MooseX::Emulate::Class::Accessor::Fast β it emulates Class::Accessor::Fast behavior using Moose attributes. that's the whole vibe. no cap. π
πΈ SYNOPSYS πΈ
(yes the section is literally spelled "SYNOPSYS", we respect the original's choices π)
package MyClass;
use Moose;
with 'MooseX::Emulate::Class::Accessor::Fast';
#fields with readers and writers
__PACKAGE__->mk_accessors(qw/field1 field2/);
#fields with readers only
__PACKAGE__->mk_ro_accessors(qw/field3 field4/);
#fields with writers only
__PACKAGE__->mk_wo_accessors(qw/field5 field6/);
look at that. three lines and you have a whole personality. π
π DESCRIPTION π
so this module is out here attempting to emulate the behavior of Class::Accessor::Fast as accurately as possible using the Moose attribute system. the public API of Class::Accessor::Fast is wholly supported β like, all of it β but the private methods are NOT. π
and if you're only using the public methods (which, bestie, you should be, that's the whole point), migration is genuinely just switching your use base line to a with line. that's it. that's the glow-up. iconic. π
ngl, the author says they've attempted to emulate the behavior of Class::Accessor::Fast as closely as possible β but bugs may still be lurking in edge-cases. so like. edge cases. be aware. π
π¦ BEHAVIOR π¦
there's simple documentation right here for your convenience, but for the thorough stuff you're gonna want to go read Class::Accessor::Fast and Class::Accessor. go on, we'll wait. π«Ά
π A note about introspection π
please note: at this time, the is flag attribute is not being set. π
so if you're trying to figure out the reader and writer methods using introspection in later versions of Class::MOP ( > 0.38 ), please use the get_read_method and get_write_method methods in Class::MOP::Attribute. example time, slay:
# with Class::MOP <= 0.38
my $attr = $self->meta->find_attribute_by_name($field_name);
my $reader_method = $attr->reader || $attr->accessor;
my $writer_method = $attr->writer || $attr->accessor;
# with Class::MOP > 0.38
my $attr = $self->meta->find_attribute_by_name($field_name);
my $reader_method = $attr->get_read_method;
my $writer_method = $attr->get_write_method;
π METHODS π
β BUILD $self %args
Change the default Moose class building to emulate the behavior of C::A::F and store arguments in the instance hashref. periodt. π
β mk_accessors @field_names
Create read-write accessors. An attribute named $field_name will be created. the name of the reader and writer methods will be determined by the return value of accessor_name_for and mutator_name_for, which by default return the name passed unchanged. π
and if the accessor and mutator names are equal, the accessor attribute will be passed to Moose; otherwise the reader and writer attributes will be passed. please see Class::MOP::Attribute for more information. iykyk. πΈ
β mk_ro_accessors @field_names
Create read-only accessors.
β mk_ro_accessors @field_names
Create write-only accessors.
okay so β this is literally what the page says. the second one is printed asmk_ro_accessors @field_namesand its description says "Create write-only accessors." the synopsis up top usesmk_wo_accessorsfor writer-only fields. we are not editing the sacred text, we're just showing you exactly what it says. π
β follow_best_practices
Preface readers with 'get_' and writers with 'set_'. See original Class::Accessor documentation for more information. π
β mutator_name_for
β accessor_name_for
See original Class::Accessor documentation for more information.
β set
See original Class::Accessor documentation for more information.
β get
See original Class::Accessor documentation for more information.
β meta
See Moose::Meta::Class.
π SEE ALSO π
MooseMoose::Meta::AttributeClass::AccessorClass::Accessor::FastClass::MOP::AttributeMooseX::Adopt::Class::Accessor::Fast
go read all of them. bestie homework. πβ¨
π«Ά AUTHORS π«Ά
Guillermo Roditi (groditi) <groditi@cpan.org>
with contributions from, and we are obsessed with them:
- Tomas Doran (t0m)
<bobtfish@bobtfish.net> - Florian Ragwitz (rafl)
<rafl@debian.org>
π LICENSE π
You may distribute this code under the same terms as Perl itself. π
and that's the page, bestie!! π¦β¨ this was perl v5.36.0, dated 2022-12-12, and it's the MooseX...::Fast(3pm) manual. go forth and migrate your use base line to a with line. you got this. mwah. π
ππΈ
π¦ where this page comes from
- debian bookworm: libmoosex-emulate-class-accessor-fast-perl 0.009032-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libmoosex-emulate-class-accessor-fast-perl 0.009032-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libmoosex-emulate-class-accessor-fast-perl 0.009032-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libmoosex-emulate-class-accessor-fast-perl 0.009032-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmoosex-emulate-class-accessor-fast-perl 0.009032-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