The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Type::Tiny::Manual - an overview of Type::Tiny

SYNOPSIS

Type::Tiny is a small class for writing type constraints, inspired by Moose's type constraint API. It has no non-core dependencies, and can be used with Moose, Mouse and Moo (or none of the above).

Type::Tiny is bundled with Type::Library a framework for organizing type constraints into collections.

Also bundled is Types::Standard, a Moose-inspired library of useful type constraints.

Type::Params is also provided, to allow very fast checking and coercion of function and method parameters.

SEE ALSO

TYPE::TINY VERSUS X

Specio

Type::Tiny is similar in aim to Specio. The major differences are

  • Type::Tiny is "tiny" (Specio will eventually have fewer dependencies than it currently does, but is unlikely to ever have zero);

  • Specio has a somewhat nicer API (better method names; less duplication), and its API is likely to improve further. Type::Tiny's aims at complete compatibility with current versions of Moose and Mouse, so there is a limit to how much I can deviate from the existing APIs of (Moose|Mouse)::Meta::TypeConstraint.

MooseX::Types

Type::Tiny libraries expose a similar interface to MooseX::Types libraries. In most cases you should be able to rewrite a MooseX::Types library to use Type::Tiny pretty easily.

MooX::Types::MooseLike

Type::Tiny is faster and supports coercions.

Scalar::Does

Scalar::Does is somewhat of a precursor to Type::Tiny, but has now been rewritten to use Type::Tiny internally.

It gives you a does($value, $type) function that is roughly equivalent to $type->check($value) except that $type may be one of a list of pre-defined strings (instead of a Type::Tiny type constraint); or may be a package name in which case it will be assumed to be a role and checked with $value->DOES($type).

BUGS

Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Type-Tiny.

SUPPORT

IRC: support is available through in the #moose channel on irc.perl.org. If Type::Tiny discussion there becomes overwhelming (unlikely) then I'll move it to a separate channel.

AUTHOR

Toby Inkster <tobyink@cpan.org>.

COPYRIGHT AND LICENCE

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.

DISCLAIMER OF WARRANTIES

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.