Moose::...::Class(3)

πŸ’– NAME πŸ’–

Moose::Meta::TypeConstraint::Class β€” it's giving class/TypeConstraint parallel hierarchy, bestie. This is the page from User Contributed Perl Documentation, and honestly? She ate. ✨


🌸 VERSION 🌸

version 2.4000 β€” yes she's got a version number, she's official, she has a whole identity 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so. This class represents type constraints for a class. That's it, that's the whole vibe. A class constraint. Very demure, very mindful, very "is this thing actually a Foo or not". πŸ’…


πŸ‘‘ INHERITANCE πŸ‘‘

Moose::Meta::TypeConstraint::Class is a subclass of Moose::Meta::TypeConstraint. So she got it from her mama, as she should. 🌈


✨ METHODS ✨

πŸŽ€ Moose::Meta::TypeConstraint::Class->new(%options)

This creates a new class type constraint based on the given %options. Slay.

It takes the same options as its parent, with two exceptions, and bestie these exceptions matter:

  1. First, it requires an additional option, class, which is the name of the constraint's class. Like you have to pass it, no skipping.
  2. Second, it automatically sets the parent to the Object type. Not you, her. She does it herself. Main character energy. πŸ‘‘

The constructor also overrides the hand optimized type constraint with one it creates internally. Yeah. She said "I'll handle that one myself, thanks." πŸ’…

🧚 $constraint->class

Returns the class name associated with the constraint. Literally just tells you which class. Simple. Iconic. No notes. πŸ’–

🌸 $constraint->parents

Returns all the type's parent types, corresponding to its parent classes. Family tree reveal, but make it types. 🌳✨

πŸ’œ $constraint->is_subtype_of($type_name_or_object)

If the given type is also a class type, then this checks that the type's class is a subclass of the other type's class. Classic "is she related to her" check.

Otherwise it falls back to the implementation in Moose::Meta::TypeConstraint. So when it can't do the class-to-class thing, it just hands it over to the parent like "you take this one." πŸ™ˆ

⭐ $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::Class object! Read that again bestie, it's a whole different class. Not the class-y one. The plain one. Do not get caught lacking. 😭

πŸ“ $constraint->get_message($value)

This is the same as "get_message" in Moose::Meta::TypeConstraint except that it explicitly says "isa" was checked. Why, you ask? To help users deal with accidentally autovivified type constraints. Yeah. Autovivification strikes again. It always does. πŸ’€


πŸ’€ BUGS πŸ’€

See "BUGS" in Moose for details on reporting bugs. Go tell the Moose people, not this page. 🫢


🫢 AUTHORS 🫢

Look at this roster, it's a whole squad, a friend group of absolute legends:

  • 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>

Ten whole icons. We love to see it. πŸ‘‘


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. So like, go wild, respectfully. πŸ’–


and that's the whole page bestie ✨ she's documented, she's version 2.4000, she's running on perl v5.42.0 and this lil writeup is dated 2025-07-25 β€” periodt, no cap, go build something cute πŸŽ€πŸ’…

πŸ“¦ where this page comes from