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 Coercion Functions
35 "to_TypeTiny($constraint)"
36 Promotes (or "demotes" if you prefer) a Moose::Meta::TypeConstraint
37 object to a Type::Tiny object.
38
39 Can also handle Validation::Class objects. Type constraints built
40 from Validation::Class objects deliberately ignore field filters
41 when they do constraint checking (and go to great lengths to do
42 so); using filters for coercion only. (The behaviour of "coerce" if
43 we don't do that is just too weird!)
44
45 Can also handle any object providing "check" and "get_message"
46 methods. (This includes Mouse::Meta::TypeConstraint objects.) If
47 the object also provides "has_coercion" and "coerce" methods, these
48 will be used too.
49
50 Can also handle coderefs (but not blessed coderefs or objects
51 overloading "&{}"). Coderefs are expected to return true iff $_
52 passes the constraint. If $_ fails the type constraint, they may
53 either return false, or die with a helpful error message.
54
55 Methods
56 These are implemented so that "Types::TypeTiny->meta->get_type($foo)"
57 works, for rough compatibility with a real Type::Library type library.
58
59 "meta"
60 "type_names"
61 "get_type($name)"
62 "has_type($name)"
63 "coercion_names"
64 "get_coercion($name)"
65 "has_coercion($name)"
66
68 Please report any bugs to
69 <http://rt.cpan.org/Dist/Display.html?Queue=Type-Tiny>.
70
72 Type::Tiny.
73
75 Toby Inkster <tobyink@cpan.org>.
76
78 This software is copyright (c) 2013-2014, 2017-2019 by Toby Inkster.
79
80 This is free software; you can redistribute it and/or modify it under
81 the same terms as the Perl 5 programming language system itself.
82
84 THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
85 WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
86 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
87
88
89
90perl v5.28.1 2019-01-08 Types::TypeTiny(3)