{
    "mode": "perldoc",
    "parameter": "Moose::Meta::TypeConstraint::Union",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Moose%3A%3AMeta%3A%3ATypeConstraint%3A%3AUnion/json",
    "generated": "2026-06-10T15:07:19Z",
    "sections": {
        "NAME": {
            "content": "Moose::Meta::TypeConstraint::Union - A union of Moose type constraints\n",
            "subsections": []
        },
        "VERSION": {
            "content": "version 2.2200\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This metaclass represents a union of type constraints. A union takes multiple type constraints,\nand is true if any one of its member constraints is true.\n",
            "subsections": []
        },
        "INHERITANCE": {
            "content": "\"Moose::Meta::TypeConstraint::Union\" is a subclass of Moose::Meta::TypeConstraint.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "Moose::Meta::TypeConstraint::Union->new(%options)\nThis creates a new class type constraint based on the given %options.\n\nIt takes the same options as its parent. It also requires an additional option,\n\"typeconstraints\". This is an array reference containing the Moose::Meta::TypeConstraint\nobjects that are the members of the union type. The \"name\" option defaults to the names all of\nthese member types sorted and then joined by a pipe (|).\n\nThe constructor sets the implementation of the constraint so that is simply calls \"check\" on the\nnewly created object.\n\nFinally, the constructor also makes sure that the object's \"coercion\" attribute is a\nMoose::Meta::TypeCoercion::Union object.\n\n$constraint->typeconstraints\nThis returns the array reference of \"typeconstraints\" provided to the constructor.\n\n$constraint->parent\nThis returns the nearest common ancestor of all the components of the union.\n\n$constraint->check($value)\n$constraint->validate($value)\nThese two methods simply call the relevant method on each of the member type constraints in the\nunion. If any type accepts the value, the value is valid.\n\nWith \"validate\" the error message returned includes all of the error messages returned by the\nmember type constraints.\n\n$constraint->equals($typenameorobject)\nA type is considered equal if it is also a union type, and the two unions have the same member\ntypes.\n\n$constraint->findtypefor($value)\nThis returns the first member type constraint for which \"check($value)\" is true, allowing you to\ndetermine which of the Union's member type constraints a given value matches.\n\n$constraint->isatypeof($typenameorobject)\nThis returns true if all of the member type constraints return true for the \"isatypeof\"\nmethod.\n\n$constraint->issubtypeof\nThis returns true if all of the member type constraints return true for the \"issubtypeof\"\nmethod.\n\n$constraint->createchildtype(%options)\nThis returns a new Moose::Meta::TypeConstraint object with the type as its parent.\n",
            "subsections": []
        },
        "BUGS": {
            "content": "See \"BUGS\" in Moose for details on reporting bugs.\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "*   Stevan Little <stevan@cpan.org>\n\n*   Dave Rolsky <autarch@urth.org>\n\n*   Jesse Luehrs <doy@cpan.org>\n\n*   Shawn M Moore <sartak@cpan.org>\n\n*   יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>\n\n*   Karen Etheridge <ether@cpan.org>\n\n*   Florian Ragwitz <rafl@debian.org>\n\n*   Hans Dieter Pearcey <hdp@cpan.org>\n\n*   Chris Prather <chris@prather.org>\n\n*   Matt S Trout <mstrout@cpan.org>\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENSE": {
            "content": "This software is copyright (c) 2006 by Infinity Interactive, Inc.\n\nThis is free software; you can redistribute it and/or modify it under the same terms as the Perl\n5 programming language system itself.\n",
            "subsections": []
        }
    },
    "summary": "Moose::Meta::TypeConstraint::Union - A union of Moose type constraints",
    "flags": [],
    "examples": [],
    "see_also": []
}