Parse:...straint(3pm)

πŸ“¦
version 1.003019 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ Parse::Method::Signatures::TypeConstraint(3pm) ✨

okay bestie, so this is a page from the User Contributed Perl Documentation, and it's giving very specific niche utility and honestly? we're obsessed πŸ’…


πŸŽ€ NAME πŸŽ€

Parse::Method::Signatures::TypeConstraint β€” the little glow-up machine that turns parsed TC data into a Moose TC object πŸ’–


🌸 DESCRIPTION 🌸

So basically, this is the class that takes your PPI elements and transforms them into Moose::Meta::TypeConstraint objects. It's the fairy godmother of type constraints, no cap 🧚✨


πŸ¦‹ ATTRIBUTES πŸ¦‹

πŸ’œ tc

Lazy Build, periodt.

This is the Moose::Meta::TypeConstraint object for this type constraint β€” and it only gets built when someone actually asks for it. And when it does get built? tc_callback gets called for each individual component type, one at a time, in turn. Patient. Methodical. Iconic. πŸ‘‘

πŸ’œ tc_callback

  • Type: CodeRef
  • Default: find_registered_constraint

This is the callback that turns type names into type objects. If you want the full tea plus an actual example, go peek at type_constraint_callback in Parse::Method::Signatures. iykyk πŸ“–βœ¨

πŸ’œ from_namespace

  • Type: ClassName

If you pass this in, then the default tc_callback will go searching for MooseX::Types in this package. She's thorough like that πŸ•΅οΈβ™€οΈπŸ’…


🌈 METHODS 🌈

⭐ find_registered_constraint

This one will search for an imported MooseX::Types inside from_namespace β€” but only if you actually provided one. If that doesn't pan out, she goes and asks the Moose::Meta::TypeConstraint::Registry for a type with the given name.

And if all of that fails? She just returns the type as a string, so that Moose's auto-vivification of classnames to type will work. Lowkey a fallback queen πŸ™ˆπŸ’–

⭐ to_string

String representation of the type constraint, approximately as parsed. Approximately! She's not doing a whole makeover, just showing you the vibe 🌸


πŸ‘€ SEE ALSO πŸ‘€

Parse::Method::Signatures, MooseX::Types, MooseX::Types::Util.


🫢 AUTHORS 🫢

  • Florian Ragwitz <rafl@debian.org>
  • Ash Berlin <ash@cpan.org>

πŸ“œ LICENSE πŸ“œ

Licensed under the same terms as Perl itself.


okay that's the whole page, you ate that, fr fr πŸ’…βœ¨

and a lil sign-off for the road: this gem was documented with perl v5.34.0, dated 2022-06-16, and it lives under the name Parse:...straint(3pm). slay πŸŽ€πŸ¦‹πŸ’–

πŸ“¦ where this page comes from