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:

  1. first, it requires an additional option, role, which is the name of the constraint's role. not optional. you will be providing it, bestie. 😭
  2. second, it automatically sets the parent to the Object type. 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>

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