1Types::TypeTiny(3)    User Contributed Perl Documentation   Types::TypeTiny(3)
2
3
4

NAME

6       Types::TypeTiny - type constraints used internally by Type::Tiny
7

STATUS

9       This module is covered by the Type-Tiny stability policy.
10

DESCRIPTION

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
19StringLike
20
21           Accepts strings and objects overloading stringification.
22
23HashLike[`a]
24
25           Accepts hashrefs and objects overloading hashification.
26
27           Since Types::TypeTiny 1.012, may be parameterized with another type
28           constraint like HashLike[Int].
29
30ArrayLike[`a]
31
32           Accepts arrayrefs and objects overloading arrayfication.
33
34           Since Types::TypeTiny 1.012, may be parameterized with another type
35           constraint like ArrayLike[Int].
36
37CodeLike
38
39           Accepts coderefs and objects overloading codification.
40
41TypeTiny
42
43           Accepts blessed Type::Tiny objects.
44
45_ForeignTypeConstraint
46
47           Any reference which to_TypeTiny recognizes as something that can be
48           coerced to a Type::Tiny object.
49
50           Yes, the underscore is included.
51
52   Coercion Functions
53       "to_TypeTiny($constraint)"
54           Promotes (or "demotes" if you prefer) a "foreign" type constraint
55           to a Type::Tiny object. Can handle:
56
57           •   Moose types (including Moose::Meta::TypeConstraint objects and
58               MooseX::Types::TypeDecorator objects).
59
60           •   Mouse types (including Mouse::Meta::TypeConstraint objects).
61
62           •   Validation::Class and Validation::Class::Simple objects.
63
64           •   Types built using Type::Library::Compiler.
65
66           •   Any object which provides "check" and "get_message" methods.
67               (This includes Specio and Type::Nano types.) If the object
68               provides "has_coercion" and coerce methods, these will be used
69               to handle quoting. If the object provides "can_be_inlined" and
70               "inline_check" methods, these will be used to handling
71               inlining.  If the object provides a "name" method, this will be
72               assumed to return the type name.
73
74           •   Coderefs (but not blessed coderefs or objects overloading "&{}"
75               unless they provide the methods described above!) Coderefs are
76               expected to return true iff $_ passes the constraint. If $_
77               fails the type constraint, they may either return false, or die
78               with a helpful error message.
79
80           •   Sub::Quote-enabled coderefs. These are handled the same way as
81               above, but Type::Tiny will consult Sub::Quote to determine if
82               they can be inlined.
83
84   Methods
85       These are implemented so that "Types::TypeTiny->meta->get_type($foo)"
86       works, for rough compatibility with a real Type::Library type library.
87
88       "meta"
89       "type_names"
90       "get_type($name)"
91       "has_type($name)"
92       "coercion_names"
93       "get_coercion($name)"
94       "has_coercion($name)"
95

BUGS

97       Please report any bugs to
98       <https://github.com/tobyink/p5-type-tiny/issues>.
99

SEE ALSO

101       Type::Tiny.
102

AUTHOR

104       Toby Inkster <tobyink@cpan.org>.
105
107       This software is copyright (c) 2013-2014, 2017-2023 by Toby Inkster.
108
109       This is free software; you can redistribute it and/or modify it under
110       the same terms as the Perl 5 programming language system itself.
111

DISCLAIMER OF WARRANTIES

113       THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
114       WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
115       MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
116
117
118
119perl v5.36.0                      2023-01-04                Types::TypeTiny(3)
Impressum