Acme-Mitey-Cards
view release on metacpan or search on metacpan
lib/Acme/Mitey/Cards/Mite.pm view on Meta::CPAN
sub ro () { 'ro' } sub rw () { 'rw' } sub rwp () { 'rwp' }
sub lazy () { 'lazy' } sub bare () { 'bare' }
# More complicated constants
BEGIN {
my @bool = ( \&false, \&true );
*_HAS_AUTOCLEAN = $bool[ 0+!! eval { require namespace::autoclean } ];
*STRICT = $bool[ 0+!! ( $ENV{PERL_STRICT} || $ENV{EXTENDED_TESTING} || $ENV{AUTHOR_TESTING} || $ENV{RELEASE_TESTING} ) ];
};
# Exportable error handlers
sub _error_handler {
my ( $func, $message, @args ) = @_;
if ( @args ) {
require Data::Dumper;
local $Data::Dumper::Terse = 1;
local $Data::Dumper::Indent = 0;
$message = sprintf $message, map {
ref($_) ? Data::Dumper::Dumper($_) : defined($_) ? $_ : '(undef)'
} @args;
}
my $next = do { require Carp; \&{"Carp::$func"} };
@_ = ( $message );
goto $next;
}
sub carp { unshift @_, 'carp' ; goto \&_error_handler }
sub croak { unshift @_, 'croak' ; goto \&_error_handler }
sub confess { unshift @_, 'confess'; goto \&_error_handler }
# Exportable guard function
{
my $GUARD_PACKAGE = __PACKAGE__ . '::Guard';
*{"$GUARD_PACKAGE\::DESTROY"} = sub { $_[0][0] or $_[0][1]->() };
*{"$GUARD_PACKAGE\::restore"} = sub { $_[0]->DESTROY; $_[0][0] = true };
*{"$GUARD_PACKAGE\::dismiss"} = sub { $_[0][0] = true };
*{"$GUARD_PACKAGE\::peek"} = sub { $_[0][2] };
*guard = sub (&) { bless [ 0, @_ ] => $GUARD_PACKAGE };
}
lib/Acme/Mitey/Cards/Mite.pm view on Meta::CPAN
and -f File::Spec->catfile( $base, substr $file, 1 + length $base )
and $orig = File::Spec->abs2rel( $file, $base )
and last;
}
# Changes to this filename must be coordinated with Mite::Compiled
my $mite_file = $orig . '.mite.pm';
local $@;
if ( not eval { require $mite_file; 1 } ) {
my $e = $@;
croak "Compiled Mite file ($mite_file) for $file is missing or an error occurred loading it: $e";
}
}
'warnings'->import;
'strict'->import;
'namespace::autoclean'->import( -cleanee => $caller )
if _HAS_AUTOCLEAN && !$arg{'-unclean'};
}
{
lib/Acme/Mitey/Cards/Types.pm view on Meta::CPAN
This type constraint library is even more basic that L<Type::Tiny>. Exported
types may be combined using C<< Foo | Bar >> but parameterized type constraints
like C<< Foo[Bar] >> are not supported.
=head2 B<Any>
Based on B<Any> in L<Types::Standard>.
The C<< Any >> constant returns a blessed type constraint object.
C<< is_Any($value) >> checks a value against the type and returns a boolean.
C<< assert_Any($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :Any );
=head2 B<ArrayRef>
Based on B<ArrayRef> in L<Types::Standard>.
The C<< ArrayRef >> constant returns a blessed type constraint object.
C<< is_ArrayRef($value) >> checks a value against the type and returns a boolean.
C<< assert_ArrayRef($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :ArrayRef );
=head2 B<Bool>
Based on B<Bool> in L<Types::Standard>.
The C<< Bool >> constant returns a blessed type constraint object.
C<< is_Bool($value) >> checks a value against the type and returns a boolean.
C<< assert_Bool($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :Bool );
=head2 B<Card>
Based on B<Card> in L<Acme::Mitey::Cards::Types::Source>.
The C<< Card >> constant returns a blessed type constraint object.
C<< is_Card($value) >> checks a value against the type and returns a boolean.
C<< assert_Card($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :Card );
=head2 B<CardArray>
Based on B<CardArray> in L<Acme::Mitey::Cards::Types::Source>.
The C<< CardArray >> constant returns a blessed type constraint object.
C<< is_CardArray($value) >> checks a value against the type and returns a boolean.
C<< assert_CardArray($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :CardArray );
=head2 B<CardNumber>
Based on B<CardNumber> in L<Acme::Mitey::Cards::Types::Source>.
The C<< CardNumber >> constant returns a blessed type constraint object.
C<< is_CardNumber($value) >> checks a value against the type and returns a boolean.
C<< assert_CardNumber($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :CardNumber );
=head2 B<Character>
Based on B<Character> in L<Acme::Mitey::Cards::Types::Source>.
The C<< Character >> constant returns a blessed type constraint object.
C<< is_Character($value) >> checks a value against the type and returns a boolean.
C<< assert_Character($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :Character );
=head2 B<ClassName>
Based on B<ClassName> in L<Types::Standard>.
The C<< ClassName >> constant returns a blessed type constraint object.
C<< is_ClassName($value) >> checks a value against the type and returns a boolean.
C<< assert_ClassName($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :ClassName );
=head2 B<CodeRef>
Based on B<CodeRef> in L<Types::Standard>.
The C<< CodeRef >> constant returns a blessed type constraint object.
C<< is_CodeRef($value) >> checks a value against the type and returns a boolean.
C<< assert_CodeRef($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :CodeRef );
=head2 B<ConsumerOf>
Based on B<ConsumerOf> in L<Types::Standard>.
The C<< ConsumerOf >> constant returns a blessed type constraint object.
C<< is_ConsumerOf($value) >> checks a value against the type and returns a boolean.
C<< assert_ConsumerOf($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :ConsumerOf );
=head2 B<CycleTuple>
Based on B<CycleTuple> in L<Types::Standard>.
The C<< CycleTuple >> constant returns a blessed type constraint object.
C<< is_CycleTuple($value) >> checks a value against the type and returns a boolean.
C<< assert_CycleTuple($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :CycleTuple );
=head2 B<Deck>
Based on B<Deck> in L<Acme::Mitey::Cards::Types::Source>.
The C<< Deck >> constant returns a blessed type constraint object.
C<< is_Deck($value) >> checks a value against the type and returns a boolean.
C<< assert_Deck($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :Deck );
=head2 B<Defined>
Based on B<Defined> in L<Types::Standard>.
The C<< Defined >> constant returns a blessed type constraint object.
C<< is_Defined($value) >> checks a value against the type and returns a boolean.
C<< assert_Defined($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :Defined );
=head2 B<DelimitedStr>
Based on B<DelimitedStr> in L<Types::Common::String>.
The C<< DelimitedStr >> constant returns a blessed type constraint object.
C<< is_DelimitedStr($value) >> checks a value against the type and returns a boolean.
C<< assert_DelimitedStr($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :DelimitedStr );
=head2 B<Dict>
Based on B<Dict> in L<Types::Standard>.
The C<< Dict >> constant returns a blessed type constraint object.
C<< is_Dict($value) >> checks a value against the type and returns a boolean.
C<< assert_Dict($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :Dict );
=head2 B<Enum>
Based on B<Enum> in L<Types::Standard>.
The C<< Enum >> constant returns a blessed type constraint object.
C<< is_Enum($value) >> checks a value against the type and returns a boolean.
C<< assert_Enum($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :Enum );
=head2 B<FaceCard>
Based on B<FaceCard> in L<Acme::Mitey::Cards::Types::Source>.
The C<< FaceCard >> constant returns a blessed type constraint object.
C<< is_FaceCard($value) >> checks a value against the type and returns a boolean.
C<< assert_FaceCard($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :FaceCard );
=head2 B<FileHandle>
Based on B<FileHandle> in L<Types::Standard>.
The C<< FileHandle >> constant returns a blessed type constraint object.
C<< is_FileHandle($value) >> checks a value against the type and returns a boolean.
C<< assert_FileHandle($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :FileHandle );
=head2 B<GlobRef>
Based on B<GlobRef> in L<Types::Standard>.
The C<< GlobRef >> constant returns a blessed type constraint object.
C<< is_GlobRef($value) >> checks a value against the type and returns a boolean.
C<< assert_GlobRef($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :GlobRef );
=head2 B<Hand>
Based on B<Hand> in L<Acme::Mitey::Cards::Types::Source>.
The C<< Hand >> constant returns a blessed type constraint object.
C<< is_Hand($value) >> checks a value against the type and returns a boolean.
C<< assert_Hand($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :Hand );
=head2 B<HasMethods>
Based on B<HasMethods> in L<Types::Standard>.
The C<< HasMethods >> constant returns a blessed type constraint object.
C<< is_HasMethods($value) >> checks a value against the type and returns a boolean.
C<< assert_HasMethods($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :HasMethods );
=head2 B<HashRef>
Based on B<HashRef> in L<Types::Standard>.
The C<< HashRef >> constant returns a blessed type constraint object.
C<< is_HashRef($value) >> checks a value against the type and returns a boolean.
C<< assert_HashRef($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :HashRef );
=head2 B<InstanceOf>
Based on B<InstanceOf> in L<Types::Standard>.
The C<< InstanceOf >> constant returns a blessed type constraint object.
C<< is_InstanceOf($value) >> checks a value against the type and returns a boolean.
C<< assert_InstanceOf($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :InstanceOf );
=head2 B<Int>
Based on B<Int> in L<Types::Standard>.
The C<< Int >> constant returns a blessed type constraint object.
C<< is_Int($value) >> checks a value against the type and returns a boolean.
C<< assert_Int($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :Int );
=head2 B<IntRange>
Based on B<IntRange> in L<Types::Common::Numeric>.
The C<< IntRange >> constant returns a blessed type constraint object.
C<< is_IntRange($value) >> checks a value against the type and returns a boolean.
C<< assert_IntRange($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :IntRange );
=head2 B<Item>
Based on B<Item> in L<Types::Standard>.
The C<< Item >> constant returns a blessed type constraint object.
C<< is_Item($value) >> checks a value against the type and returns a boolean.
C<< assert_Item($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :Item );
=head2 B<JokerCard>
Based on B<JokerCard> in L<Acme::Mitey::Cards::Types::Source>.
The C<< JokerCard >> constant returns a blessed type constraint object.
C<< is_JokerCard($value) >> checks a value against the type and returns a boolean.
C<< assert_JokerCard($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :JokerCard );
=head2 B<LaxNum>
Based on B<LaxNum> in L<Types::Standard>.
The C<< LaxNum >> constant returns a blessed type constraint object.
C<< is_LaxNum($value) >> checks a value against the type and returns a boolean.
C<< assert_LaxNum($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :LaxNum );
=head2 B<LowerCaseSimpleStr>
Based on B<LowerCaseSimpleStr> in L<Types::Common::String>.
The C<< LowerCaseSimpleStr >> constant returns a blessed type constraint object.
C<< is_LowerCaseSimpleStr($value) >> checks a value against the type and returns a boolean.
C<< assert_LowerCaseSimpleStr($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :LowerCaseSimpleStr );
=head2 B<LowerCaseStr>
Based on B<LowerCaseStr> in L<Types::Common::String>.
The C<< LowerCaseStr >> constant returns a blessed type constraint object.
C<< is_LowerCaseStr($value) >> checks a value against the type and returns a boolean.
C<< assert_LowerCaseStr($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :LowerCaseStr );
=head2 B<Map>
Based on B<Map> in L<Types::Standard>.
The C<< Map >> constant returns a blessed type constraint object.
C<< is_Map($value) >> checks a value against the type and returns a boolean.
C<< assert_Map($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :Map );
=head2 B<Maybe>
Based on B<Maybe> in L<Types::Standard>.
The C<< Maybe >> constant returns a blessed type constraint object.
C<< is_Maybe($value) >> checks a value against the type and returns a boolean.
C<< assert_Maybe($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :Maybe );
=head2 B<NegativeInt>
Based on B<NegativeInt> in L<Types::Common::Numeric>.
The C<< NegativeInt >> constant returns a blessed type constraint object.
C<< is_NegativeInt($value) >> checks a value against the type and returns a boolean.
C<< assert_NegativeInt($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :NegativeInt );
=head2 B<NegativeNum>
Based on B<NegativeNum> in L<Types::Common::Numeric>.
The C<< NegativeNum >> constant returns a blessed type constraint object.
C<< is_NegativeNum($value) >> checks a value against the type and returns a boolean.
C<< assert_NegativeNum($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :NegativeNum );
=head2 B<NegativeOrZeroInt>
Based on B<NegativeOrZeroInt> in L<Types::Common::Numeric>.
The C<< NegativeOrZeroInt >> constant returns a blessed type constraint object.
C<< is_NegativeOrZeroInt($value) >> checks a value against the type and returns a boolean.
C<< assert_NegativeOrZeroInt($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :NegativeOrZeroInt );
=head2 B<NegativeOrZeroNum>
Based on B<NegativeOrZeroNum> in L<Types::Common::Numeric>.
The C<< NegativeOrZeroNum >> constant returns a blessed type constraint object.
C<< is_NegativeOrZeroNum($value) >> checks a value against the type and returns a boolean.
C<< assert_NegativeOrZeroNum($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :NegativeOrZeroNum );
=head2 B<NonEmptySimpleStr>
Based on B<NonEmptySimpleStr> in L<Types::Common::String>.
The C<< NonEmptySimpleStr >> constant returns a blessed type constraint object.
C<< is_NonEmptySimpleStr($value) >> checks a value against the type and returns a boolean.
C<< assert_NonEmptySimpleStr($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :NonEmptySimpleStr );
=head2 B<NonEmptyStr>
Based on B<NonEmptyStr> in L<Types::Common::String>.
The C<< NonEmptyStr >> constant returns a blessed type constraint object.
C<< is_NonEmptyStr($value) >> checks a value against the type and returns a boolean.
C<< assert_NonEmptyStr($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :NonEmptyStr );
=head2 B<Num>
Based on B<Num> in L<Types::Standard>.
The C<< Num >> constant returns a blessed type constraint object.
C<< is_Num($value) >> checks a value against the type and returns a boolean.
C<< assert_Num($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :Num );
=head2 B<NumRange>
Based on B<NumRange> in L<Types::Common::Numeric>.
The C<< NumRange >> constant returns a blessed type constraint object.
C<< is_NumRange($value) >> checks a value against the type and returns a boolean.
C<< assert_NumRange($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :NumRange );
=head2 B<NumericCard>
Based on B<NumericCard> in L<Acme::Mitey::Cards::Types::Source>.
The C<< NumericCard >> constant returns a blessed type constraint object.
C<< is_NumericCard($value) >> checks a value against the type and returns a boolean.
C<< assert_NumericCard($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :NumericCard );
=head2 B<NumericCode>
Based on B<NumericCode> in L<Types::Common::String>.
The C<< NumericCode >> constant returns a blessed type constraint object.
C<< is_NumericCode($value) >> checks a value against the type and returns a boolean.
C<< assert_NumericCode($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :NumericCode );
=head2 B<Object>
Based on B<Object> in L<Types::Standard>.
The C<< Object >> constant returns a blessed type constraint object.
C<< is_Object($value) >> checks a value against the type and returns a boolean.
C<< assert_Object($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :Object );
=head2 B<OptList>
Based on B<OptList> in L<Types::Standard>.
The C<< OptList >> constant returns a blessed type constraint object.
C<< is_OptList($value) >> checks a value against the type and returns a boolean.
C<< assert_OptList($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :OptList );
=head2 B<Optional>
Based on B<Optional> in L<Types::Standard>.
The C<< Optional >> constant returns a blessed type constraint object.
C<< is_Optional($value) >> checks a value against the type and returns a boolean.
C<< assert_Optional($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :Optional );
=head2 B<Overload>
Based on B<Overload> in L<Types::Standard>.
The C<< Overload >> constant returns a blessed type constraint object.
C<< is_Overload($value) >> checks a value against the type and returns a boolean.
C<< assert_Overload($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :Overload );
=head2 B<Password>
Based on B<Password> in L<Types::Common::String>.
The C<< Password >> constant returns a blessed type constraint object.
C<< is_Password($value) >> checks a value against the type and returns a boolean.
C<< assert_Password($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :Password );
=head2 B<PositiveInt>
Based on B<PositiveInt> in L<Types::Common::Numeric>.
The C<< PositiveInt >> constant returns a blessed type constraint object.
C<< is_PositiveInt($value) >> checks a value against the type and returns a boolean.
C<< assert_PositiveInt($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :PositiveInt );
=head2 B<PositiveNum>
Based on B<PositiveNum> in L<Types::Common::Numeric>.
The C<< PositiveNum >> constant returns a blessed type constraint object.
C<< is_PositiveNum($value) >> checks a value against the type and returns a boolean.
C<< assert_PositiveNum($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :PositiveNum );
=head2 B<PositiveOrZeroInt>
Based on B<PositiveOrZeroInt> in L<Types::Common::Numeric>.
The C<< PositiveOrZeroInt >> constant returns a blessed type constraint object.
C<< is_PositiveOrZeroInt($value) >> checks a value against the type and returns a boolean.
C<< assert_PositiveOrZeroInt($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :PositiveOrZeroInt );
=head2 B<PositiveOrZeroNum>
Based on B<PositiveOrZeroNum> in L<Types::Common::Numeric>.
The C<< PositiveOrZeroNum >> constant returns a blessed type constraint object.
C<< is_PositiveOrZeroNum($value) >> checks a value against the type and returns a boolean.
C<< assert_PositiveOrZeroNum($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :PositiveOrZeroNum );
=head2 B<Ref>
Based on B<Ref> in L<Types::Standard>.
The C<< Ref >> constant returns a blessed type constraint object.
C<< is_Ref($value) >> checks a value against the type and returns a boolean.
C<< assert_Ref($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :Ref );
=head2 B<RegexpRef>
Based on B<RegexpRef> in L<Types::Standard>.
The C<< RegexpRef >> constant returns a blessed type constraint object.
C<< is_RegexpRef($value) >> checks a value against the type and returns a boolean.
C<< assert_RegexpRef($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :RegexpRef );
=head2 B<RoleName>
Based on B<RoleName> in L<Types::Standard>.
The C<< RoleName >> constant returns a blessed type constraint object.
C<< is_RoleName($value) >> checks a value against the type and returns a boolean.
C<< assert_RoleName($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :RoleName );
=head2 B<ScalarRef>
Based on B<ScalarRef> in L<Types::Standard>.
The C<< ScalarRef >> constant returns a blessed type constraint object.
C<< is_ScalarRef($value) >> checks a value against the type and returns a boolean.
C<< assert_ScalarRef($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :ScalarRef );
=head2 B<Set>
Based on B<Set> in L<Acme::Mitey::Cards::Types::Source>.
The C<< Set >> constant returns a blessed type constraint object.
C<< is_Set($value) >> checks a value against the type and returns a boolean.
C<< assert_Set($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :Set );
=head2 B<SimpleStr>
Based on B<SimpleStr> in L<Types::Common::String>.
The C<< SimpleStr >> constant returns a blessed type constraint object.
C<< is_SimpleStr($value) >> checks a value against the type and returns a boolean.
C<< assert_SimpleStr($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :SimpleStr );
=head2 B<SingleDigit>
Based on B<SingleDigit> in L<Types::Common::Numeric>.
The C<< SingleDigit >> constant returns a blessed type constraint object.
C<< is_SingleDigit($value) >> checks a value against the type and returns a boolean.
C<< assert_SingleDigit($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :SingleDigit );
=head2 B<Slurpy>
Based on B<Slurpy> in L<Types::Standard>.
The C<< Slurpy >> constant returns a blessed type constraint object.
C<< is_Slurpy($value) >> checks a value against the type and returns a boolean.
C<< assert_Slurpy($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :Slurpy );
=head2 B<Str>
Based on B<Str> in L<Types::Standard>.
The C<< Str >> constant returns a blessed type constraint object.
C<< is_Str($value) >> checks a value against the type and returns a boolean.
C<< assert_Str($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :Str );
=head2 B<StrLength>
Based on B<StrLength> in L<Types::Common::String>.
The C<< StrLength >> constant returns a blessed type constraint object.
C<< is_StrLength($value) >> checks a value against the type and returns a boolean.
C<< assert_StrLength($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :StrLength );
=head2 B<StrMatch>
Based on B<StrMatch> in L<Types::Standard>.
The C<< StrMatch >> constant returns a blessed type constraint object.
C<< is_StrMatch($value) >> checks a value against the type and returns a boolean.
C<< assert_StrMatch($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :StrMatch );
=head2 B<StrictNum>
Based on B<StrictNum> in L<Types::Standard>.
The C<< StrictNum >> constant returns a blessed type constraint object.
C<< is_StrictNum($value) >> checks a value against the type and returns a boolean.
C<< assert_StrictNum($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :StrictNum );
=head2 B<StrongPassword>
Based on B<StrongPassword> in L<Types::Common::String>.
The C<< StrongPassword >> constant returns a blessed type constraint object.
C<< is_StrongPassword($value) >> checks a value against the type and returns a boolean.
C<< assert_StrongPassword($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :StrongPassword );
=head2 B<Suit>
Based on B<Suit> in L<Acme::Mitey::Cards::Types::Source>.
The C<< Suit >> constant returns a blessed type constraint object.
C<< is_Suit($value) >> checks a value against the type and returns a boolean.
C<< assert_Suit($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :Suit );
=head2 B<Tied>
Based on B<Tied> in L<Types::Standard>.
The C<< Tied >> constant returns a blessed type constraint object.
C<< is_Tied($value) >> checks a value against the type and returns a boolean.
C<< assert_Tied($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :Tied );
=head2 B<Tuple>
Based on B<Tuple> in L<Types::Standard>.
The C<< Tuple >> constant returns a blessed type constraint object.
C<< is_Tuple($value) >> checks a value against the type and returns a boolean.
C<< assert_Tuple($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :Tuple );
=head2 B<Undef>
Based on B<Undef> in L<Types::Standard>.
The C<< Undef >> constant returns a blessed type constraint object.
C<< is_Undef($value) >> checks a value against the type and returns a boolean.
C<< assert_Undef($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :Undef );
=head2 B<UpperCaseSimpleStr>
Based on B<UpperCaseSimpleStr> in L<Types::Common::String>.
The C<< UpperCaseSimpleStr >> constant returns a blessed type constraint object.
C<< is_UpperCaseSimpleStr($value) >> checks a value against the type and returns a boolean.
C<< assert_UpperCaseSimpleStr($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :UpperCaseSimpleStr );
=head2 B<UpperCaseStr>
Based on B<UpperCaseStr> in L<Types::Common::String>.
The C<< UpperCaseStr >> constant returns a blessed type constraint object.
C<< is_UpperCaseStr($value) >> checks a value against the type and returns a boolean.
C<< assert_UpperCaseStr($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :UpperCaseStr );
=head2 B<Value>
Based on B<Value> in L<Types::Standard>.
The C<< Value >> constant returns a blessed type constraint object.
C<< is_Value($value) >> checks a value against the type and returns a boolean.
C<< assert_Value($value) >> checks a value against the type and throws an error.
To import all of these functions:
use Acme::Mitey::Cards::Types qw( :Value );
=head1 TYPE CONSTRAINT METHODS
For any type constraint B<Foo> the following methods are available:
Foo->check( $value ) # boolean
Foo->get_message( $value ) # error message, even if $value is ok
Foo->validate( $value ) # error message, or undef if ok
Foo->assert_valid( $value ) # returns true, dies if error
Foo->assert_return( $value ) # returns $value, or dies if error
Foo->to_TypeTiny # promotes the object to Type::Tiny
Objects overload stringification to return their name and overload
coderefification to call C<assert_return>.
The objects as-is can be used in L<Moo> or L<Mite> C<isa> options.
has myattr => (
is => 'rw',
isa => Foo,
( run in 0.765 second using v1.01-cache-2.11-cpan-65fba6d93b7 )