MooseX...ssRoles(3pm)
π MooseX::RelatedClassRoles β aka the MooseX...ssRoles(3pm) page, bestie π
okay so this is a page from the User Contributed Perl Documentation collection, and it's literally the manual for MooseX::RelatedClassRoles. pull up a chair, grab a boba, we're doing this π§β¨
β¨ NAME β¨
MooseX::RelatedClassRoles β apply roles to a class related to yours. that's it, that's the whole vibe π«Ά
πΈ VERSION πΈ
version 0.004 β baby number, iconic number π
π SYNOPSIS π
package My::Class;
use Moose;
has driver_class => (
isa => 'MyApp::Driver',
);
with 'MooseX::RelatedClassRoles' => { name => 'driver' };
# ...
my $obj = My::Class->new(driver_class => "Some::Driver");
$obj->apply_driver_class_roles("Other::Driver::Role");
see how easy that was?? no cap, that's the whole thing π₯
π¦ DESCRIPTION π¦
so like, a lot of the time you end up using a class that hands you some "foo_class" accessor or attribute, and it's doing the whole method-of-dependency-injection thing. you know the one. it's giving very "here's a slot, go fill it" energy.
now β use this role when you'd rather apply roles to build your own custom "foo_class" instead of doing the whole manual subclass setup by hand. the way that you justβ¦ don't have to write a subclass?? obsessed. truly the main character move π
β PARAMETERS β
π« name
a string that names the related class. in the SYNOPSIS that's "driver". Required. like, non-negotiable, you gotta give it this one bestie π
π« class_accessor_name
a string naming the related class accessor. in the SYNOPSIS that's "driver_class". it defaults to appending "_class" to the name. cute, right? π
π« apply_method_name
a string naming the role applying method. in the SYNOPSIS that's "apply_driver_class_names". it defaults to adding "apply_" and "_names" to the class_accessor_name. yes queen, auto-naming β¨
π BLAME π
Florian Ragwitz (rafl)
putting this here verbatim because that's the section and I don't make the rules π«‘
π AUTHOR π
Hans Dieter Pearcey <hdp@cpan.org>
periodt π
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2009 by Hans Dieter Pearcey <hdp@cpan.org>.
This is free software; you can redistribute it and/or modify it under the same terms as perl itself. so like, go wild, but respectfully πΈ
β οΈ heads up bestie: thoseapply_method_name/class_accessor_namebits are quoted exactly as the original page has them. I am simply the messenger π§
okay and finally, the lil sign-off β this page came from perl v5.32.0, dated 2021-01-07, and lives in the MooseX...ssRoles(3pm) slot of the docs. thanks for coming to my ted talk, stan Moose roles, bye bestieeee ππ¦β¨
π¦ where this page comes from
- debian bookworm: libmoosex-relatedclassroles-perl 0.004-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libmoosex-relatedclassroles-perl 0.004-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libmoosex-relatedclassroles-perl 0.004-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libmoosex-relatedclassroles-perl 0.004-1.1 Β· 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