Moose::...nt::Role(3)
π Moose::Meta::TypeConstraint::Role π
okay bestie, so this is a page from the User Contributed Perl Documentation, and it's all about Moose::Meta::TypeConstraint::Role β the whole Role/TypeConstraint parallel hierarchy situation. it's giving "roles but make it type constraints" and honestly? iconic. π
β¨ VERSION β¨
version 2.4000 π¦
πΈ DESCRIPTION πΈ
so basically, this class represents type constraints for a role. that's the whole vibe. it's a role, but as a type constraint. main character energy, fr fr. π
π INHERITANCE π
Moose::Meta::TypeConstraint::Role is a subclass of Moose::Meta::TypeConstraint. so it inherited the whole fit from its parent and then customized it. as it should. π«Ά
β METHODS β
π§ Moose::Meta::TypeConstraint::Role->new(%options)
this creates a new role type constraint based on the given %options. slay.
it takes the same options as its parent, with two exceptions:
- first, it requires an additional option,
role, which is the name of the constraint's role. not optional. you will be providing it, bestie. π - second, it automatically sets the parent to the
Objecttype. no notes, it just does that.
the constructor also overrides the hand optimized type constraint with one it creates internally. don't ask, it's just built different. β¨
π¦ $constraint->role
returns the role name associated with the constraint. cute, simple, does what it says on the tin. π
π $constraint->parents
returns all the type's parent types, corresponding to the roles that its role does. it's a whole family tree moment. π
π₯ $constraint->is_subtype_of($type_name_or_object)
if the given type is also a role type, then this checks that the type's role does the other type's role. like, does your role do their role? then yes, subtype. periodt.
otherwise it falls back to the implementation in Moose::Meta::TypeConstraint. it knows when to delegate, we love a collaborator. π
π $constraint->create_child_type(%options)
this returns a new Moose::Meta::TypeConstraint object with the type as its parent.
β οΈ note that it does not return a Moose::Meta::TypeConstraint::Role object! read that again bestie, it's giving plot twist. not the role class, the plain one. no cap. π
π BUGS π
see "BUGS" in Moose for details on reporting bugs. if something's cursed, that's where you go. π
π AUTHORS π
these are the legends who made it happen, give them their flowers π:
- 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>
π 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. free as in do-whatever, bestie. π«Ά
and that's a wrap on this little perl v5.42.0 moment, dated 2025-07-25 π tysm for reading, go forth and subtype responsibly πβ¨
π¦ 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