{"id":7198,"date":"2022-12-20T19:35:48","date_gmt":"2022-12-20T22:35:48","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/moosemetatypeconstraintunion-man3\/"},"modified":"2022-12-20T19:35:48","modified_gmt":"2022-12-20T22:35:48","slug":"moosemetatypeconstraintunion-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/moosemetatypeconstraintunion-man3\/","title":{"rendered":"Moose::Meta::TypeConstraint::Union (man3)"},"content":{"rendered":"<h1 align=\"center\">Moose::Meta::TypeConstraint::Union<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#VERSION\">VERSION<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#INHERITANCE\">INHERITANCE<\/a><br \/> <a href=\"#METHODS\">METHODS<\/a><br \/> <a href=\"#BUGS\">BUGS<\/a><br \/> <a href=\"#AUTHORS\">AUTHORS<\/a><br \/> <a href=\"#COPYRIGHT AND LICENSE\">COPYRIGHT AND LICENSE<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Moose::Meta::TypeConstraint::Union \u2212 A union of Moose type constraints<\/p>\n<h2>VERSION <a name=\"VERSION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">version 2.2014<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This metaclass represents a union of type constraints. A union takes multiple type constraints, and is true if any one of its member constraints is true.<\/p>\n<h2>INHERITANCE <a name=\"INHERITANCE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">&#8220;Moose::Meta::TypeConstraint::Union&#8221; is a subclass of Moose::Meta::TypeConstraint.<\/p>\n<h2>METHODS <a name=\"METHODS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Moose::Meta::TypeConstraint::Union\u2212>new(%options)<\/b> <br \/> This creates a new class type constraint based on the given %options.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">It takes the same options as its parent. It also requires an additional option, &#8220;type_constraints&#8221;. This is an array reference containing the Moose::Meta::TypeConstraint objects that are the members of the union type. The &#8220;name&#8221; option defaults to the names all of these member types sorted and then joined by a pipe (|).<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The constructor sets the implementation of the constraint so that is simply calls &#8220;check&#8221; on the newly created object.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Finally, the constructor also makes sure that the object\u2019s &#8220;coercion&#8221; attribute is a Moose::Meta::TypeCoercion::Union object.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>$constraint\u2212>type_constraints<\/b> <br \/> This returns the array reference of &#8220;type_constraints&#8221; provided to the constructor.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>$constraint\u2212>parent<\/b> <br \/> This returns the nearest common ancestor of all the components of the union.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>$constraint\u2212>check($value) <br \/> $constraint\u2212>validate($value)<\/b> <br \/> These two methods simply call the relevant method on each of the member type constraints in the union. If any type accepts the value, the value is valid.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">With &#8220;validate&#8221; the error message returned includes all of the error messages returned by the member type constraints.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>$constraint\u2212>equals($type_name_or_object)<\/b> <br \/> A type is considered equal if it is also a union type, and the two unions have the same member types.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>$constraint\u2212>find_type_for($value)<\/b> <br \/> This returns the first member type constraint for which &#8220;check($value)&#8221; is true, allowing you to determine which of the Union\u2019s member type constraints a given value matches.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>$constraint\u2212>is_a_type_of($type_name_or_object)<\/b> <br \/> This returns true if all of the member type constraints return true for the &#8220;is_a_type_of&#8221; method.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>$constraint\u2212>is_subtype_of<\/b> <br \/> This returns true if all of the member type constraints return true for the &#8220;is_subtype_of&#8221; method.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>$constraint\u2212>create_child_type(%options)<\/b> <br \/> This returns a new Moose::Meta::TypeConstraint object with the type as its parent.<\/p>\n<h2>BUGS <a name=\"BUGS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">See &#8221; <small>BUGS&#8221;<\/small> in Moose for details on reporting bugs.<\/p>\n<h2>AUTHORS <a name=\"AUTHORS\"><\/a> <\/h2>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p style=\"margin-top: 1em\">\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p style=\"margin-top: 1em\">Stevan Little <stevan@cpan.org><\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>Dave Rolsky <autarch@urth.org><\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>Jesse Luehrs <doy@cpan.org><\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>Shawn M Moore <sartak@cpan.org><\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>\u00d7\u00d7\u00d7\u00d7 \u00d7\u00a7\u00d7\u00d7\u2019\u00d7\u00d7 (Yuval Kogman) <nothingmuch@woobling.org><\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>Karen Etheridge <ether@cpan.org><\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>Florian Ragwitz <rafl@debian.org><\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>Hans Dieter Pearcey <hdp@cpan.org><\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>Chris Prather <chris@prather.org><\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>Matt S Trout <mstrout@cpan.org><\/p>\n<\/td>\n<\/tr>\n<\/table>\n<h2>COPYRIGHT AND LICENSE <a name=\"COPYRIGHT AND LICENSE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This software is copyright (c) 2006 by Infinity Interactive, Inc.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This is free software; you can redistribute it and\/or modify it under the same terms as the Perl 5 programming language system itself.<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  Moose::Meta::TypeConstraint::Union \u2212 A union of Moose type constraints <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3007,3529],"class_list":["post-7198","post","type-post","status-publish","format-standard","hentry","category-sin-categoria","tag-man3","tag-moosemetatypeconstraintunion"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7198","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=7198"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7198\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=7198"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=7198"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=7198"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}