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 πŸ’œβœ¨


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