Types::TypeTiny - type constraints used internally by Type::Tiny
Dogfooding.
This isn't a real Type::Library-based type library; that would involve too much circularity. But it exports some type constraint "constants":
StringLike
HashLike
ArrayLike
CodeLike
TypeTiny
to_TypeTiny($constraint)
Promotes (or "demotes" if you prefer) a Moose::Meta::TypeConstraint object to a Type::Tiny object.
Can also handle Validation::Class objects. Type constraints built from Validation::Class objects deliberately ignore field filters when they do constraint checking (and go to great lengths to do so); using filters for coercion only. (The behaviour of coerce if we don't do that is just too weird!)
coerce
Can also handle any object providing check and get_message methods. (This includes Mouse::Meta::TypeConstraint objects.) If the object also provides has_coercion and coerce methods, these will be used too.
check
get_message
has_coercion
Can also handle coderefs (but not blessed coderefs or objects overloading &{}). Coderefs are expected to return true iff $_ passes the constraint. If $_ fails the type constraint, they may either return false, or die with a helpful error message.
&{}
$_
These are implemented so that Types::TypeTiny->meta->get_type($foo) works, for rough compatibility with a real Type::Library type library.
Types::TypeTiny->meta->get_type($foo)
meta
get_type($name)
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Type-Tiny.
Type::Tiny.
Toby Inkster <tobyink@cpan.org>.
This software is copyright (c) 2013 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
To install Type::Tiny, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Type::Tiny
CPAN shell
perl -MCPAN -e shell install Type::Tiny
For more information on module installation, please visit the detailed CPAN module installation guide.