Class:...n::Fast(3pm)
π Class::Accessor::Children::Fast π
okay bestie, so this is a 3pm perl manual page (user-contributed perl documentation, the good stuff), and it's all about Class::Accessor::Children::Fast β a module that does child-class + accessor generation but, like, fast. no cap.
β¨ NAME β¨
Class::Accessor::Children::Fast β Faster, child-class/accessor generation πβοΈπ¨
π¦ SYNOPSIS π¦
so here's the glow-up, bestie. before? kinda mid. after? iconic.
BEFORE (WITHOUT THIS)
look at all this copy-paste energy π three whole packages, three whole use base lines, the same thing over and over:
package MyClass::Foo;
use base qw( Class:Accessor::Fast );
__PACKAGE__->mk_ro_accessors(qw( jacob michael joshua ethan ));
package MyClass::Bar;
use base qw( Class:Accessor::Fast );
__PACKAGE__->mk_ro_accessors(qw( emily emma madison isabella ));
package MyClass::Baz;
use base qw( Class:Accessor::Fast );
__PACKAGE__->mk_ro_accessors(qw( haruka haruto miyu yuto ));
(and yes, Class:Accessor::Fast really is spelled like that in there β one colon, two colons, whatever, it's verbatim, don't @ me π
)
AFTER (WITH THIS)
one package. one use base. one call. ate and left no crumbs:
package MyClass;
use base qw( Class::Accessor::Children::Fast );
__PACKAGE__->mk_child_ro_accessors(
Foo => [qw( jacob michael joshua ethan )],
Bar => [qw( emily emma madison isabella )],
Baz => [qw( haruka haruto miyu yuto )],
);
πΈ DESCRIPTION πΈ
this module automagically generates child classes that come with accessor/mutator methods already installed. like, they just appear. slay. β¨
and the way it does it? it inherits from Class::Accessor::Fast to make the accessors. that's the whole trick. periodt. π
π METHODS π
this module hands you the following methods in addition to all the methods provided by Class::Accessor::Fast β so everything you already know and love is still right there, bestie.
π mk_child_accessors
the vibe:
MyClass->mk_child_accessors( Foo => \@fields, ... );
this generates a child class named MyClass::Foo that has accessor/mutator methods, one for each name listed in \@fields. read + write, the full package. π
π mk_child_ro_accessors
the vibe:
MyClass->mk_child_ro_accessors( Bar => \@fields, ... );
this generates a child class named MyClass::Bar that has read-only accessors (ie. true accessors). look but don't touch, bestie. π
π mk_child_wo_accessors
the vibe:
MyClass->mk_child_wo_accessors( Baz => \@fields, ... );
this generates a child class named MyClass::Baz that has write-only accessors (ie. mutators). you can set it, but you can't get it back. mystery main character energy. π¦
π SEE ALSO π
Class::Accessor::ChildrenClass::Accessor::Fast
π AUTHOR π
Yusuke Kawasaki <http://www.kawa.net/> β the icon who made this fr fr π«Ά
π COPYRIGHT AND LICENSE π
Copyright (c) 2007 Yusuke Kawasaki. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
β legal bit said with love: same terms as Perl itself, so go forth and remix responsibly.
and that's the whole page, bestie! this gem shipped as perl v5.36.0, dated 2022-12-11, under Class:...n::Fast(3pm) β the truncation is giving "we ran out of room in the header" but you know exactly what it means. bye pookie, go generate some children πβ¨π
π¦ where this page comes from
- debian bookworm: libclass-accessor-children-perl 0.02-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libclass-accessor-children-perl 0.02-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libclass-accessor-children-perl 0.02-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libclass-accessor-children-perl 0.02-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libclass-accessor-children-perl 0.02-3 Β· 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