1Type::Tiny::Union(3) User Contributed Perl Documentation Type::Tiny::Union(3)
2
3
4
6 Type::Tiny::Union - union type constraints
7
9 This module is covered by the Type-Tiny stability policy.
10
12 Union type constraints.
13
14 This package inherits from Type::Tiny; see that for most documentation.
15 Major differences are listed below:
16
17 Attributes
18 "type_constraints"
19 Arrayref of type constraints.
20
21 When passed to the constructor, if any of the type constraints in
22 the union is itself a union type constraint, this is "exploded"
23 into the new union.
24
25 "constraint"
26 Unlike Type::Tiny, you cannot pass a constraint coderef to the
27 constructor. Instead rely on the default.
28
29 "inlined"
30 Unlike Type::Tiny, you cannot pass an inlining coderef to the
31 constructor. Instead rely on the default.
32
33 "parent"
34 Unlike Type::Tiny, you cannot pass an inlining coderef to the
35 constructor. A parent will instead be automatically calculated.
36
37 "coercion"
38 You probably do not pass this to the constructor. (It's not
39 currently disallowed, as there may be a use for it that I haven't
40 thought of.)
41
42 The auto-generated default will be a Type::Coercion::Union object.
43
44 Methods
45 "find_type_for($value)"
46 Returns the first individual type constraint in the union which
47 $value passes.
48
49 "stringifies_to($constraint)"
50 See Type::Tiny::ConstrainedObject.
51
52 "numifies_to($constraint)"
53 See Type::Tiny::ConstrainedObject.
54
55 "with_attribute_values($attr1 => $constraint1, ...)"
56 See Type::Tiny::ConstrainedObject.
57
58 Overloading
59 • Arrayrefification calls "type_constraints".
60
62 Please report any bugs to
63 <https://github.com/tobyink/p5-type-tiny/issues>.
64
66 Type::Tiny::Manual.
67
68 Type::Tiny.
69
71 Toby Inkster <tobyink@cpan.org>.
72
74 This software is copyright (c) 2013-2014, 2017-2021 by Toby Inkster.
75
76 This is free software; you can redistribute it and/or modify it under
77 the same terms as the Perl 5 programming language system itself.
78
80 THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
81 WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
82 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
83
84
85
86perl v5.34.0 2021-09-13 Type::Tiny::Union(3)