NAME

Type::Tiny::Wrapper - a type constraint that is only useful when wrapping another type constraint

DESCRIPTION

This is a subclass of Type::Tiny used internally by Types::ReadOnly. The API is not considered stable; it may change in response to Type::ReadOnly's needs.

Attributes

It provides the following additional attributes.

pre_check, pre_coerce, post_check, post_coerce.

Coderefs which fire on certain events. Each coderef is passed $self and the value being checked/coerced as parameters. The value being checked/coerced is also available in $_.

For the check events, the coderef is expected to return false if the value fails the check, and return true if checking the value should proceed to the wrapped type constraint.

inlined_pre_check, inlined_pre_coerce, inlined_post_check, inlined_post_coerce

Coderefs that can inline the pre/post check/coerce events.

Each coderef is passed $self and the variable name to be checked/coerced as parameters. The variable name is also available in $_.

Expected to return a string of Perl code which evaluates to an expression. Checks can alternatively return a list of such strings, which will be joined by "&&".

Method

wrap($other)

Wraps a type constraint and returns a Type::Tiny::Wrapped object.

BUGS

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

SEE ALSO

Type::Tiny::Manual, Hash::Util, Const::Fast, MooseX::Types::Ro.

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.