MooseX...::Role(3pm)
π¦ MooseX...::Role β the vibe β¨
okay bestie, so this whole page is MooseX...::Role(3pm) from the User Contributed Perl Documentation, and honestly? it's giving "tiny module, big feelings." it's the metarole role for storing code attributes. let's get into it π
π« VERSION
version 0.32 β yeah, that's the one. no cap.
πΈ SYNOPSIS
look, here's the whole thing in action:
package MyRole;
use MooseX::MethodAttributes::Role;
sub foo : Bar Baz('corge') { ... }
package MyClass
use Moose;
with 'MyRole';
my $attrs = MyClass->meta->get_method('foo')->attributes; # ["Bar", "Baz('corge')"]
see how $attrs comes back as ["Bar", "Baz('corge')"]? that's the whole point of this module and it ate π
π DESCRIPTION
so this module is a metaclass role, and it gets applied by MooseX::MethodAttributes::Role. what does that mean for you? it means you can add code attributes to methods in Moose roles. that's it. that's the gig.
and then β and this is the iconic part β those attributes can be found by introspecting the role metaclass, and they get automatically copied into any classes or roles that the role gets composed onto. automatic. no extra work. main character energy fr fr π«Ά
β¨ METHODS β¨
initialize
this one makes sure that the package holding your role methods does the MooseX::MethodAttributes::Role::AttrContainer role during initialisation. and that role? it's the one responsible for capturing the method attributes on the class and registering them with the metaclass. so like, initialize isn't doing the capturing itself, it's making sure the right container shows up to the party π
method_metaclass
this wraps the normal method and makes sure that the method metaclass performs the MooseX::MethodAttributes::Role::Meta::Method role. why do we care? because that's what lets you introspect the attributes from the method objects the MOP hands back when you're querying the metaclass. no method metaclass role, no attribute peeking. simple as π¦
π CAVEATS
listen, we gotta talk about the limits, bestie. read this part.
- currently, roles with attributes cannot have methods excluded or aliased, and they will in turn confer this property onto any roles they are composed onto. so yeah β it's contagious. lowkey annoying, highkey important to know before you go wild π
π«Ά SUPPORT
bugs may be submitted through the RT bug tracker at https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-MethodAttributes (or you can just email bug-MooseX-MethodAttributes@rt.cpan.org) π
there's also a mailing list available for users of this distribution, at http://lists.perl.org/list/moose.html.
and there's an irc channel available for users of this distribution too, at #moose on irc.perl.org (irc://irc.perl.org/#moose). come hang out, the people are lovely π
π AUTHORS
- Florian Ragwitz
<rafl@debian.org> - Tomas Doran
<bobtfish@bobtfish.net>
the icons who made this happen π
π COPYRIGHT AND LICENCE
this software is copyright (c) 2009 by Florian Ragwitz.
this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay π
and that's the whole page, bestie!! it came from perl v5.30.3 and it's dated 2020-08-31, so yeah, this page is a lil vintage but it still serves β¨ go forth and attribute your methods, you absolute legend πππ¦
π¦ where this page comes from
- debian bookworm: libmoosex-methodattributes-perl 0.32-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libmoosex-methodattributes-perl 0.32-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libmoosex-methodattributes-perl 0.32-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libmoosex-methodattributes-perl 0.32-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libmoosex-methodattributes-perl 0.32-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmoosex-methodattributes-perl 0.32-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