MooseX...ssRoles(3pm)

πŸ“¦
version 0.004 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

πŸ’– 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 πŸ’–


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: those apply_method_name / class_accessor_name bits 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