++ed by:
KFLY TOBYINK ABRAXXA ZMUGHAL AWNCORP

5 PAUSE users
2 non-PAUSE users.

Toby Inkster

NAME

Type::Nano - simple type constraint library for testing

SYNOPSIS

  use Type::Nano qw(Int);
  
  Int->check("42");  # true

DESCRIPTION

This is a really basic implementation of Type::API::Constraint for testing modules that make use of type constraints, such as Type::Tie.

It optionally exports the following type constraints:

  • Any

  • Defined

  • Undef

  • Ref

  • ArrayRef

  • HashRef

  • CodeRef

  • Object

  • Str

  • Bool

  • Num

  • Int

Types support the following methods:

$type->check($value)

Checks the value against the constraint; returns a boolean.

$type->get_message($failing_value)

Returns an error message. Does not check the value.

Types overload &{} to do something like:

  $type->check($value) or croak($type->get_message($value))

I'll stress that this module is only intended for use in testing. It eliminates Type::Tie's testing dependency on Types::Standard.

Type::Tiny while bigger than Type::Nano, will be much faster at runtime, and offers better integration with Moo, Moose, Mouse, and a wide variety of other tools. Use that instead.

BUGS

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

SUPPORT

IRC: support is available through in the #moops channel on irc.perl.org.

SEE ALSO

Type::API.

AUTHOR

Toby Inkster <tobyink@cpan.org>.

COPYRIGHT AND LICENCE

This software is copyright (c) 2018 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.