Moose::...tribute(3)
π Moose::Meta::Role::Attribute π
okay bestie, so this is the manual page for Moose::Meta::Role::Attribute, coming at you from the User Contributed Perl Documentation corner of the internet. it's the Moose attribute metaclass for Roles, and yes it's as niche and iconic as it sounds π
β¨ VERSION β¨
version 2.4000 β that's the one we're on, no cap π«Ά
πΈ DESCRIPTION πΈ
so like, this class implements the API for attributes in roles. and here's the tea: attributes in roles are more like attribute prototypes than full blown attributes. they're introspectable, sure, but they have very little behavior. they're giving "understudy who knows all the lines but never goes on stage" energy π
π¦ METHODS π¦
Moose::Meta::Role::Attribute->new(...)
this method accepts all the options that would be passed to the constructor for Moose::Meta::Attribute. all of them. every single one. it's very generous like that β¨
$attr->metaclass
$attr->is
returns the option as passed to the constructor. straightforward, lowkey perfect, we love a method that just does what it says π
$attr->associated_role
returns the Moose::Meta::Role to which this attribute belongs, if any. (that "if any" is doing a lot of work, just saying π)
$attr->original_role
returns the Moose::Meta::Role in which this attribute was first defined. and listen β this may not be the same as the value of associated_role() for attributes in a composite role, or when one role consumes other roles. so don't come for me if they don't match, they're not supposed to π
$attr->original_options
returns a hash reference of options passed to the constructor. this is used when creating a Moose::Meta::Attribute object from this object. like a little recipe card for rebuilding yourself, obsessed π
$attr->attach_to_role($role)
attaches the attribute to the given Moose::Meta::Role. that's it. that's the whole method. periodt π
$attr->attribute_for_class($metaclass)
given an attribute metaclass name, this method calls $metaclass->interpolate_class_and_new to construct an attribute object which can be added to a Moose::Meta::Class. very "glow up into something a class can actually use" of it π
$attr->clone
creates a new object identical to the object on which the method is called. twin behavior fr fr π
$attr->is_same_as($other_attr)
compares two role attributes and returns true if they are identical. vibe check: passed β
In addition, this class implements all informational predicates implements by Moose::Meta::Attribute (and Class::MOP::Attribute).
ok so tiny note: yes, the original says "implements by" and I am not about to gaslight you by silently fixing the grammar. facts are facts bestie, typos and all π«Ά
π BUGS π
See "BUGS" in Moose for details on reporting bugs. found a bug? go tell Moose, not me, I'm just the messenger π
π AUTHORS π
- Stevan Little
<stevan@cpan.org> - Dave Rolsky
<autarch@urth.org> - Jesse Luehrs
<doy@cpan.org> - Shawn M Moore
<sartak@cpan.org> - ΧΧΧΧ Χ§ΧΧ'ΧΧ (Yuval Kogman)
<nothingmuch@woobling.org> - Karen Etheridge
<ether@cpan.org> - Florian Ragwitz
<rafl@debian.org> - Hans Dieter Pearcey
<hdp@cpan.org> - Chris Prather
<chris@prather.org> - Matt S Trout
<mstrout@cpan.org>
look at this roster. absolute legends, every single one. the way they all built this... iconic behavior, no notes πβ¨
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2006 by Infinity Interactive, Inc.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
and that's the whole page bestie!! π this beauty is running on perl v5.42.0, dated 2025-07-25, so if you're reading this from the future β hey, hope the syntax still slays πΈβ¨ mwah, go write some roles π
π¦ where this page comes from
- fedora 43: perl-Moose 2.4000-4.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms