1Types::TypeTiny(3) User Contributed Perl Documentation Types::TypeTiny(3)
2
3
4
6 Types::TypeTiny - type constraints used internally by Type::Tiny
7
9 This module is covered by the Type-Tiny stability policy.
10
12 Dogfooding.
13
14 This isn't a real Type::Library-based type library; that would involve
15 too much circularity. But it exports some type constraints which, while
16 designed for use within Type::Tiny, may be more generally useful.
17
18 Types
19 "StringLike"
20 Accepts strings and objects overloading stringification.
21
22 "HashLike"
23 Accepts hashrefs and objects overloading hashification.
24
25 "ArrayLike"
26 Accepts arrayrefs and objects overloading arrayfication.
27
28 "CodeLike"
29 Accepts coderefs and objects overloading codification.
30
31 "TypeTiny"
32 Accepts blessed Type::Tiny objects.
33
34 "_ForeignTypeConstraint"
35 Any reference which to_TypeTiny recognizes as something that can be
36 coerced to a Type::Tiny object.
37
38 Yeah, the underscore is included.
39
40 Coercion Functions
41 "to_TypeTiny($constraint)"
42 Promotes (or "demotes" if you prefer) a Moose::Meta::TypeConstraint
43 object to a Type::Tiny object.
44
45 Can also handle Validation::Class objects. Type constraints built
46 from Validation::Class objects deliberately ignore field filters
47 when they do constraint checking (and go to great lengths to do
48 so); using filters for coercion only. (The behaviour of "coerce" if
49 we don't do that is just too weird!)
50
51 Can also handle any object providing "check" and "get_message"
52 methods. (This includes Mouse::Meta::TypeConstraint objects.) If
53 the object also provides "has_coercion" and "coerce" methods, these
54 will be used too.
55
56 Can also handle coderefs (but not blessed coderefs or objects
57 overloading "&{}"). Coderefs are expected to return true iff $_
58 passes the constraint. If $_ fails the type constraint, they may
59 either return false, or die with a helpful error message.
60
61 Methods
62 These are implemented so that "Types::TypeTiny->meta->get_type($foo)"
63 works, for rough compatibility with a real Type::Library type library.
64
65 "meta"
66 "type_names"
67 "get_type($name)"
68 "has_type($name)"
69 "coercion_names"
70 "get_coercion($name)"
71 "has_coercion($name)"
72
74 Please report any bugs to
75 <http://rt.cpan.org/Dist/Display.html?Queue=Type-Tiny>.
76
78 Type::Tiny.
79
81 Toby Inkster <tobyink@cpan.org>.
82
84 This software is copyright (c) 2013-2014, 2017-2020 by Toby Inkster.
85
86 This is free software; you can redistribute it and/or modify it under
87 the same terms as the Perl 5 programming language system itself.
88
90 THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
91 WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
92 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
93
94
95
96perl v5.30.1 2020-02-12 Types::TypeTiny(3)