Moose::...::Union(3)

πŸ’– Moose::...::Union β€” the manual page, but make it a group chat πŸ’–

okay bestie, welcome to Moose::...::Union(3) β€” a User Contributed Perl Documentation page, and honestly? she's niche but she's important. 🌸


✨ NAME ✨

Moose::Meta::TypeCoercion::Union β€” the Moose Type Coercion metaclass for Unions. That's her whole name, no notes. πŸ‘‘


πŸŽ€ VERSION πŸŽ€

version 2.4000

yes queen, she's on 2.4000, keep up. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

So, the vibe here: this is a subclass of Moose::Meta::TypeCoercion. πŸ“š

And what is she for, you ask? She gets used for Moose::Meta::TypeConstraint::Union objects. That's the whole assignment. That's it. Union type coercions, but make it a class. ✨


πŸ’œ METHODS πŸ’œ

🌟 $coercion->has_coercion_for_type

This method always returns false. Like, always. Every time. No exceptions, no maybe, no "it depends." false, periodt. πŸ’€

🌟 $coercion->add_type_coercions

This method always throws an error. 🚨

Because bestie... you literally cannot add coercions to a union type coercion. That's not a thing. The method exists and it will yell at you. Do not fight her on this. πŸ™ˆ

🌟 $coercion->coerce($value)

Okay this one actually does the thing. ✨

It will coerce by trying the coercions for each type in the union. That's the whole strategy β€” go down the list of types, try their coercions, see what sticks. 🫢


πŸ’€ BUGS πŸ’€

Want the tea on reporting bugs? Go read "BUGS" in Moose for all the details. She'll tell you where to send them. πŸ›


πŸ‘‘ AUTHORS πŸ‘‘

Shoutout to the whole squad, the icons, the 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>

every single one of them, no cap. πŸ’…


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. πŸͺ✨


and that's the page, bestie! this one shipped as part of perl v5.42.0, dated 2025-07-25 β€” so go forth, coerce your unions, and remember: add_type_coercions said no and she meant it. πŸ«ΆπŸ’–

πŸ“¦ where this page comes from