.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Type::Tiny::Manual 3pm" .TH Type::Tiny::Manual 3pm "2014-10-25" "perl v5.20.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Type::Tiny::Manual \- an overview of Type::Tiny .SH "SYNOPSIS" .IX Header "SYNOPSIS" Type::Tiny is a small class for writing type constraints, inspired by Moose's type constraint \s-1API.\s0 It has only one non-core dependency (and even that is simply a module that was previously distributed as part of Type::Tiny but has since been spun off), and can be used with Moose, Mouse and Moo (or none of the above). .PP Type::Tiny is bundled with Type::Library a framework for organizing type constraints into collections. .PP Also bundled is Types::Standard, a Moose-inspired library of useful type constraints. .PP Type::Params is also provided, to allow very fast checking and coercion of function and method parameters. .SH "SEE ALSO" .IX Header "SEE ALSO" .IP "\(bu" 4 Libraries \- how to build a type library with Type::Tiny, Type::Library and Type::Utils .IP "\(bu" 4 Coercions \- adding coercions to type constraints .IP "\(bu" 4 Using with Moose \- how to use Type::Tiny and Type::Library with Moose .IP "\(bu" 4 Using with Mouse \- how to use Type::Tiny and Type::Library with Mouse .IP "\(bu" 4 Using with Moo \- how to use Type::Tiny and Type::Library with Moo .IP "\(bu" 4 Using with Other \s-1OO\s0 Frameworks \- how to use Type::Tiny and Type::Library with other \s-1OO\s0 frameworks .IP "\(bu" 4 Type::Tiny and friends don't need to be used within an \s-1OO\s0 framework. See FreeMind::Node for an example that does not. .IP "\(bu" 4 Processing arguments to subs \- coerce and validate arguments to functions and methods. .IP "\(bu" 4 Other modules using Type::Tiny in interesting ways: Type::Tie, Test::Mocha, Scalar::Does, Set::Equivalence... .IP "\(bu" 4 Optimization \- squeeze the most out of your \s-1CPU.\s0 .IP "\(bu" 4 Type::Tiny maintenance policies \- the stability policy. .SH "DEPENDENCIES" .IX Header "DEPENDENCIES" Type::Tiny requires at least Perl 5.6.1, though certain Unicode-related features (e.g. non-ASCII type constraint names) may work better in newer versions of Perl. .PP Type::Tiny requires Exporter::Tiny, a module that was previously bundled in this distribution, but has since been spun off as a separate distribution. Don't worry \- it's quick and easy to install. .PP At run-time, Type::Tiny also requires the following modules: B, B::Deparse, Carp, Data::Dumper, Scalar::Util, Text::Balanced, overload, strict and warnings. All of these come bundled with Perl itself. Prior to Perl 5.8, Scalar::Util and Text::Balanced do not come bundled with Perl and will need installing separately from the \s-1CPAN.\s0 .PP Certain features require additional modules. Tying a variable to a type constraint (e.g. \f(CW\*(C`tie my $count, Int\*(C'\fR) requires Type::Tie; stack traces on exceptions require Devel::StackTrace. The Reply::Plugin::TypeTiny plugin for Reply requires Reply (obviously). Devel::LexAlias may \fIslightly\fR increase the speed of some of Type::Tiny's compiled coderefs. .PP Type::Tiny::XS is not required, but if available provides a speed boost for some type checks. (Setting the environment variable \&\f(CW\*(C`PERL_TYPE_TINY_XS\*(C'\fR to false, or setting \f(CW\*(C`PERL_ONLY\*(C'\fR to true will suppress the use of Type::Tiny::XS, even if it is available.) .PP The test suite additionally requires Test::More, Test::Fatal and Test::Requires. Test::More comes bundled with Perl, but if you are using a version of Perl older than 5.14, you will need to upgrade to at least Test::More version 0.96. Test::Requires and Test::Fatal (plus Try::Tiny which Test::Fatal depends on) are bundled with Type::Tiny in the \f(CW\*(C`inc\*(C'\fR directory, so you do not need to install them separately. .PP If using Type::Tiny in conjunction with Moo, then at least Moo 1.001000 is recommended. If using Type::Tiny with Moose, then at least Moose 2.0600 is recommended. If using Type::Tiny with Mouse, then at least Mouse 1.00 is recommended. Type::Tiny is mostly untested against older versions of these packages. .SH "TYPE::TINY VERSUS X" .IX Header "TYPE::TINY VERSUS X" .SS "Specio" .IX Subsection "Specio" Type::Tiny is similar in aim to Specio. The major differences are .IP "\(bu" 4 Type::Tiny is \*(L"tiny\*(R" (Specio will eventually have fewer dependencies than it currently does, but is unlikely to ever have as few as Type::Tiny); .IP "\(bu" 4 Specio has a somewhat nicer \s-1API \s0(better method names; less duplication), and its \s-1API\s0 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. .SS "MooseX::Types" .IX Subsection "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. .SS "MooX::Types::MooseLike" .IX Subsection "MooX::Types::MooseLike" Type::Tiny is faster and supports coercions. .SS "Scalar::Does" .IX Subsection "Scalar::Does" Scalar::Does is somewhat of a precursor to Type::Tiny, but has now been rewritten to use Type::Tiny internally. .PP It gives you a \f(CW\*(C`does($value, $type)\*(C'\fR function that is roughly equivalent to \f(CW\*(C`$type\->check($value)\*(C'\fR except that \f(CW$type\fR 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 \&\f(CW\*(C`$value\->DOES($type)\*(C'\fR. .SH "BUGS" .IX Header "BUGS" Please report any bugs to . .SH "SUPPORT" .IX Header "SUPPORT" \&\fB\s-1IRC:\s0\fR support is available through in the \fI#moops\fR channel on irc.perl.org . .SH "AUTHOR" .IX Header "AUTHOR" Toby Inkster . .SH "COPYRIGHT AND LICENCE" .IX Header "COPYRIGHT AND LICENCE" This software is copyright (c) 2013\-2014 by Toby Inkster. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. .SH "DISCLAIMER OF WARRANTIES" .IX Header "DISCLAIMER OF WARRANTIES" \&\s-1THIS PACKAGE IS PROVIDED \*(L"AS IS\*(R" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.\s0