1Moose::Meta::TypeConstrUasienrt:C:oUnntiroinb(u3t)ed PerMlooDsoec:u:mMeenttaa:t:iToynpeConstraint::Union(3)
2
3
4

NAME

6       Moose::Meta::TypeConstraint::Union - A union of Moose type constraints
7

DESCRIPTION

9       This metaclass represents a union of type constraints. A union takes
10       multiple type constraints, and is true if any one of its member
11       constraints is true.
12

INHERITANCE

14       "Moose::Meta::TypeConstraint::Union" is a subclass of
15       Moose::Meta::TypeConstraint.
16
17       Moose::Meta::TypeConstraint::Union->new(%options)
18           This creates a new class type constraint based on the given
19           %options.
20
21           It takes the same options as its parent. It also requires an
22           additional option, "type_constraints". This is an array reference
23           containing the Moose::Meta::TypeConstraint objects that are the
24           members of the union type. The "name" option defaults to the names
25           all of these member types sorted and then joined by a pipe (|).
26
27           The constructor sets the implementation of the constraint so that
28           is simply calls "check" on the newly created object.
29
30           Finally, the constructor also makes sure that the object's
31           "coercion" attribute is a Moose::Meta::TypeCoercion::Union object.
32
33       $constraint->type_constraints
34           This returns the array reference of "type_constraints" provided to
35           the constructor.
36
37       $constraint->parents
38           This returns the same constraint as the "type_constraints" method.
39
40       $constraint->check($value)
41       $constraint->validate($value)
42           These two methods simply call the relevant method on each of the
43           member type constraints in the union. If any type accepts the
44           value, the value is valid.
45
46           With "validate" the error message returned includes all of the
47           error messages returned by the member type constraints.
48
49       $constraint->equals($type_name_or_object)
50           A type is considered equal if it is also a union type, and the two
51           unions have the same member types.
52
53       $constraint->find_type_for($value)
54           This returns the first member type constraint for which
55           "check($value)" is true, allowing you to determine which of the
56           Union's member type constraints a given value matches.
57
58       $constraint->is_a_type_of($type_name_or_object)
59           This returns true if any of the member type constraints return true
60           for the "is_a_type_of" method.
61
62       $constraint->is_subtype_of
63           This returns true if any of the member type constraints return true
64           for the "is_a_subtype_of" method.
65
66       $constraint->create_child_type(%options)
67           This returns a new Moose::Meta::TypeConstraint object with the type
68           as its parent.
69

BUGS

71       See "BUGS" in Moose for details on reporting bugs.
72

AUTHOR

74       Stevan Little <stevan@iinteractive.com>
75
77       Copyright 2006-2010 by Infinity Interactive, Inc.
78
79       <http://www.iinteractive.com>
80
81       This library is free software; you can redistribute it and/or modify it
82       under the same terms as Perl itself.
83
84
85
86perl v5.12.2                      2010-12-M0o1ose::Meta::TypeConstraint::Union(3)
Impressum