.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" 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 >0, 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 .\" ======================================================================== .\" .IX Title "Types::TypeTiny 3pm" .TH Types::TypeTiny 3pm "2023-07-21" "perl v5.36.0" "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" Types::TypeTiny \- type constraints used internally by Type::Tiny .SH "STATUS" .IX Header "STATUS" This module is covered by the Type-Tiny stability policy. .PP The \fBBoolLike\fR type is currently unstable. .SH "DESCRIPTION" .IX Header "DESCRIPTION" Dogfooding. .PP This isn't a real Type::Library\-based type library; that would involve too much circularity. But it exports some type constraints which, while designed for use within Type::Tiny, may be more generally useful. .SS "Types" .IX Subsection "Types" .IP "\(bu" 4 \&\fBStringLike\fR .Sp Accepts strings and objects overloading stringification. .IP "\(bu" 4 \&\fBBoolLike\fR .Sp Accepts undef, "\*(L", 0, 1; accepts any blessed object overloading \*(R"bool\*(L"; accepts any blessed object overloading \*(R"0+" to return 0 or 1. (Needs to actually call the overloaded operation to check that.) .Sp Warning: an object which overloads \*(L"0+\*(R" without also turning on overload fallbacks may actually be useless as a practical boolean. But some common objects such as \s-1JSON::PP\s0's booleans overload \*(L"0+\*(R" instead of overloading \&\*(L"bool\*(R" (thankfully with fallbacks enabled!) so we do need to support this. .Sp The intention of this type is to be a version of \fBBool\fR which also accepts common boolean objects such as JSON::PP::Boolean. It is currently unstable and the exact definition of the type may change to better implement that intended functionality. .IP "\(bu" 4 \&\fBHashLike[`a]\fR .Sp Accepts hashrefs and objects overloading hashification. .Sp Since Types::TypeTiny 1.012, may be parameterized with another type constraint like \fBHashLike[Int]\fR. .IP "\(bu" 4 \&\fBArrayLike[`a]\fR .Sp Accepts arrayrefs and objects overloading arrayfication. .Sp Since Types::TypeTiny 1.012, may be parameterized with another type constraint like \fBArrayLike[Int]\fR. .IP "\(bu" 4 \&\fBCodeLike\fR .Sp Accepts coderefs and objects overloading codification. .IP "\(bu" 4 \&\fBTypeTiny\fR .Sp Accepts blessed Type::Tiny objects. .IP "\(bu" 4 \&\fB_ForeignTypeConstraint\fR .Sp Any reference which to_TypeTiny recognizes as something that can be coerced to a Type::Tiny object. .Sp Yes, the underscore is included. .SS "Coercion Functions" .IX Subsection "Coercion Functions" .ie n .IP """to_TypeTiny($constraint)""" 4 .el .IP "\f(CWto_TypeTiny($constraint)\fR" 4 .IX Item "to_TypeTiny($constraint)" Promotes (or \*(L"demotes\*(R" if you prefer) a \*(L"foreign\*(R" type constraint to a Type::Tiny object. Can handle: .RS 4 .IP "\(bu" 4 Moose types (including Moose::Meta::TypeConstraint objects and MooseX::Types::TypeDecorator objects). .IP "\(bu" 4 Mouse types (including Mouse::Meta::TypeConstraint objects). .IP "\(bu" 4 Validation::Class and Validation::Class::Simple objects. .IP "\(bu" 4 Types built using Type::Library::Compiler. .IP "\(bu" 4 Any object which provides \f(CW\*(C`check\*(C'\fR and \f(CW\*(C`get_message\*(C'\fR methods. (This includes Specio and Type::Nano types.) If the object provides \f(CW\*(C`has_coercion\*(C'\fR and coerce methods, these will be used to handle quoting. If the object provides \f(CW\*(C`can_be_inlined\*(C'\fR and \f(CW\*(C`inline_check\*(C'\fR methods, these will be used to handling inlining. If the object provides a \f(CW\*(C`name\*(C'\fR method, this will be assumed to return the type name. .IP "\(bu" 4 Coderefs (but not blessed coderefs or objects overloading \f(CW\*(C`&{}\*(C'\fR unless they provide the methods described above!) Coderefs are expected to return true iff \f(CW$_\fR passes the constraint. If \f(CW$_\fR fails the type constraint, they may either return false, or die with a helpful error message. .IP "\(bu" 4 Sub::Quote\-enabled coderefs. These are handled the same way as above, but Type::Tiny will consult Sub::Quote to determine if they can be inlined. .RE .RS 4 .RE .SS "Methods" .IX Subsection "Methods" These are implemented so that \f(CW\*(C`Types::TypeTiny\->meta\->get_type($foo)\*(C'\fR works, for rough compatibility with a real Type::Library type library. .ie n .IP """meta""" 4 .el .IP "\f(CWmeta\fR" 4 .IX Item "meta" .PD 0 .ie n .IP """type_names""" 4 .el .IP "\f(CWtype_names\fR" 4 .IX Item "type_names" .ie n .IP """get_type($name)""" 4 .el .IP "\f(CWget_type($name)\fR" 4 .IX Item "get_type($name)" .ie n .IP """has_type($name)""" 4 .el .IP "\f(CWhas_type($name)\fR" 4 .IX Item "has_type($name)" .ie n .IP """coercion_names""" 4 .el .IP "\f(CWcoercion_names\fR" 4 .IX Item "coercion_names" .ie n .IP """get_coercion($name)""" 4 .el .IP "\f(CWget_coercion($name)\fR" 4 .IX Item "get_coercion($name)" .ie n .IP """has_coercion($name)""" 4 .el .IP "\f(CWhas_coercion($name)\fR" 4 .IX Item "has_coercion($name)" .PD .SH "BUGS" .IX Header "BUGS" Please report any bugs to . .SH "SEE ALSO" .IX Header "SEE ALSO" Type::Tiny. .SH "AUTHOR" .IX Header "AUTHOR" Toby Inkster . .SH "COPYRIGHT AND LICENCE" .IX Header "COPYRIGHT AND LICENCE" This software is copyright (c) 2013\-2014, 2017\-2023 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