MooseX:...it::Role(3)

hey bestie πŸ’– welcome to the MooseX:...it::Role(3) page β€” yes, that’s the manual name folded in right up top, from the User Contributed Perl Documentation. buckle up, we’re doing class attributes in roles and it’s lowkey iconic.

🌸 NAME 🌸

MooseX::ClassAttribute::Trait::Role β€” A trait for roles with class attributes. that’s the whole vibe: a trait, for roles, with class attributes. periodt.

✨ VERSION ✨

version 0.29 β€” short, sweet, slaying.

πŸŽ€ SYNOPSIS πŸŽ€

okay so this is the little loop they show you:

for my $attr ( HasClassAttributes->meta()->get_all_class_attributes() )
{
    print $attr->name();
}

cute, right? it walks all the class attributes and prints their names. no cap.

πŸ¦‹ DESCRIPTION πŸ¦‹

This role adds awareness of class attributes to a role metaclass object. It provides a set of introspection methods that largely parallel the existing attribute methods, except they operate on class attributes. it’s giving β€œsame energy, but for class attributes.” πŸ’…

πŸ’… METHODS πŸ’…

Every method provided by this role has an analogous method in Class::MOP::Class or Moose::Meta::Class for regular attributes. so if you already know those, you’re lowkey already fluent. iykyk.

$meta->has_class_attribute($name) / $meta->get_class_attribute($name) / $meta->get_class_attribute_list()

These methods are exactly like their counterparts in MooseX::ClassAttribute::Trait::Class. no extra plot twists.

$meta->add_class_attribute(...)

This accepts the same options as the Moose::Meta::Attribute add_attribute() method. However, if an attribute is specified as "required" an error will be thrown. so bestie, do not mark it required unless you’re ready for the drama 😭.

$meta->remove_class_attribute($name)

If the named class attribute exists, it is removed from the role. simple as that. poof. ✨

πŸ’€ BUGS πŸ’€

See MooseX::ClassAttribute for details.

Bugs may be submitted through the RT bug tracker http://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-ClassAttribute (or bug-moosex-classattribute@rt.cpan.org <mailto:bug-moosex-classattribute@rt.cpan.org>).

I am also usually active on IRC as 'drolsky' on irc://irc.perl.org. so yeah, that’s the bug-reporting situation, fr fr.

πŸ‘‘ AUTHOR πŸ‘‘

Dave Rolsky <autarch@urth.org>. iconic.

This software is Copyright (c) 2016 by Dave Rolsky.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)

okay that’s the whole manual page β€” footer sign-off vibes: source/version perl v5.42.0, date 2016-05-31, and the manual name MooseX:...it::Role(3). bye bestie, go introspect those class attributes 🫢

πŸ“¦ where this page comes from