The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Acme::Mitey::Cards::Types - type constraint library

TYPES

This type constraint library is even more basic that Type::Tiny. Exported types may be combined using Foo | Bar but parameterized type constraints like Foo[Bar] are not supported.

Any

Based on Any in Types::Standard.

The Any constant returns a blessed type constraint object. is_Any($value) checks a value against the type and returns a boolean. 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 );

ArrayRef

Based on ArrayRef in Types::Standard.

The ArrayRef constant returns a blessed type constraint object. is_ArrayRef($value) checks a value against the type and returns a boolean. 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 );

Bool

Based on Bool in Types::Standard.

The Bool constant returns a blessed type constraint object. is_Bool($value) checks a value against the type and returns a boolean. 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 );

Card

Based on Card in Acme::Mitey::Cards::Types::Source.

The Card constant returns a blessed type constraint object. is_Card($value) checks a value against the type and returns a boolean. 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 );

CardArray

Based on CardArray in Acme::Mitey::Cards::Types::Source.

The CardArray constant returns a blessed type constraint object. is_CardArray($value) checks a value against the type and returns a boolean. 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 );

CardNumber

Based on CardNumber in Acme::Mitey::Cards::Types::Source.

The CardNumber constant returns a blessed type constraint object. is_CardNumber($value) checks a value against the type and returns a boolean. 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 );

Character

Based on Character in Acme::Mitey::Cards::Types::Source.

The Character constant returns a blessed type constraint object. is_Character($value) checks a value against the type and returns a boolean. 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 );

ClassName

Based on ClassName in Types::Standard.

The ClassName constant returns a blessed type constraint object. is_ClassName($value) checks a value against the type and returns a boolean. 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 );

CodeRef

Based on CodeRef in Types::Standard.

The CodeRef constant returns a blessed type constraint object. is_CodeRef($value) checks a value against the type and returns a boolean. 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 );

ConsumerOf

Based on ConsumerOf in Types::Standard.

The ConsumerOf constant returns a blessed type constraint object. is_ConsumerOf($value) checks a value against the type and returns a boolean. 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 );

CycleTuple

Based on CycleTuple in Types::Standard.

The CycleTuple constant returns a blessed type constraint object. is_CycleTuple($value) checks a value against the type and returns a boolean. 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 );

Deck

Based on Deck in Acme::Mitey::Cards::Types::Source.

The Deck constant returns a blessed type constraint object. is_Deck($value) checks a value against the type and returns a boolean. 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 );

Defined

Based on Defined in Types::Standard.

The Defined constant returns a blessed type constraint object. is_Defined($value) checks a value against the type and returns a boolean. 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 );

DelimitedStr

Based on DelimitedStr in Types::Common::String.

The DelimitedStr constant returns a blessed type constraint object. is_DelimitedStr($value) checks a value against the type and returns a boolean. 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 );

Dict

Based on Dict in Types::Standard.

The Dict constant returns a blessed type constraint object. is_Dict($value) checks a value against the type and returns a boolean. 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 );

Enum

Based on Enum in Types::Standard.

The Enum constant returns a blessed type constraint object. is_Enum($value) checks a value against the type and returns a boolean. 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 );

FaceCard

Based on FaceCard in Acme::Mitey::Cards::Types::Source.

The FaceCard constant returns a blessed type constraint object. is_FaceCard($value) checks a value against the type and returns a boolean. 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 );

FileHandle

Based on FileHandle in Types::Standard.

The FileHandle constant returns a blessed type constraint object. is_FileHandle($value) checks a value against the type and returns a boolean. 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 );

GlobRef

Based on GlobRef in Types::Standard.

The GlobRef constant returns a blessed type constraint object. is_GlobRef($value) checks a value against the type and returns a boolean. 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 );

Hand

Based on Hand in Acme::Mitey::Cards::Types::Source.

The Hand constant returns a blessed type constraint object. is_Hand($value) checks a value against the type and returns a boolean. 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 );

HasMethods

Based on HasMethods in Types::Standard.

The HasMethods constant returns a blessed type constraint object. is_HasMethods($value) checks a value against the type and returns a boolean. 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 );

HashRef

Based on HashRef in Types::Standard.

The HashRef constant returns a blessed type constraint object. is_HashRef($value) checks a value against the type and returns a boolean. 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 );

InstanceOf

Based on InstanceOf in Types::Standard.

The InstanceOf constant returns a blessed type constraint object. is_InstanceOf($value) checks a value against the type and returns a boolean. 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 );

Int

Based on Int in Types::Standard.

The Int constant returns a blessed type constraint object. is_Int($value) checks a value against the type and returns a boolean. 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 );

IntRange

Based on IntRange in Types::Common::Numeric.

The IntRange constant returns a blessed type constraint object. is_IntRange($value) checks a value against the type and returns a boolean. 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 );

Item

Based on Item in Types::Standard.

The Item constant returns a blessed type constraint object. is_Item($value) checks a value against the type and returns a boolean. 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 );

JokerCard

Based on JokerCard in Acme::Mitey::Cards::Types::Source.

The JokerCard constant returns a blessed type constraint object. is_JokerCard($value) checks a value against the type and returns a boolean. 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 );

LaxNum

Based on LaxNum in Types::Standard.

The LaxNum constant returns a blessed type constraint object. is_LaxNum($value) checks a value against the type and returns a boolean. 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 );

LowerCaseSimpleStr

Based on LowerCaseSimpleStr in Types::Common::String.

The LowerCaseSimpleStr constant returns a blessed type constraint object. is_LowerCaseSimpleStr($value) checks a value against the type and returns a boolean. 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 );

LowerCaseStr

Based on LowerCaseStr in Types::Common::String.

The LowerCaseStr constant returns a blessed type constraint object. is_LowerCaseStr($value) checks a value against the type and returns a boolean. 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 );

Map

Based on Map in Types::Standard.

The Map constant returns a blessed type constraint object. is_Map($value) checks a value against the type and returns a boolean. 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 );

Maybe

Based on Maybe in Types::Standard.

The Maybe constant returns a blessed type constraint object. is_Maybe($value) checks a value against the type and returns a boolean. 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 );

NegativeInt

Based on NegativeInt in Types::Common::Numeric.

The NegativeInt constant returns a blessed type constraint object. is_NegativeInt($value) checks a value against the type and returns a boolean. 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 );

NegativeNum

Based on NegativeNum in Types::Common::Numeric.

The NegativeNum constant returns a blessed type constraint object. is_NegativeNum($value) checks a value against the type and returns a boolean. 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 );

NegativeOrZeroInt

Based on NegativeOrZeroInt in Types::Common::Numeric.

The NegativeOrZeroInt constant returns a blessed type constraint object. is_NegativeOrZeroInt($value) checks a value against the type and returns a boolean. 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 );

NegativeOrZeroNum

Based on NegativeOrZeroNum in Types::Common::Numeric.

The NegativeOrZeroNum constant returns a blessed type constraint object. is_NegativeOrZeroNum($value) checks a value against the type and returns a boolean. 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 );

NonEmptySimpleStr

Based on NonEmptySimpleStr in Types::Common::String.

The NonEmptySimpleStr constant returns a blessed type constraint object. is_NonEmptySimpleStr($value) checks a value against the type and returns a boolean. 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 );

NonEmptyStr

Based on NonEmptyStr in Types::Common::String.

The NonEmptyStr constant returns a blessed type constraint object. is_NonEmptyStr($value) checks a value against the type and returns a boolean. 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 );

Num

Based on Num in Types::Standard.

The Num constant returns a blessed type constraint object. is_Num($value) checks a value against the type and returns a boolean. 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 );

NumRange

Based on NumRange in Types::Common::Numeric.

The NumRange constant returns a blessed type constraint object. is_NumRange($value) checks a value against the type and returns a boolean. 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 );

NumericCard

Based on NumericCard in Acme::Mitey::Cards::Types::Source.

The NumericCard constant returns a blessed type constraint object. is_NumericCard($value) checks a value against the type and returns a boolean. 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 );

NumericCode

Based on NumericCode in Types::Common::String.

The NumericCode constant returns a blessed type constraint object. is_NumericCode($value) checks a value against the type and returns a boolean. 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 );

Object

Based on Object in Types::Standard.

The Object constant returns a blessed type constraint object. is_Object($value) checks a value against the type and returns a boolean. 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 );

OptList

Based on OptList in Types::Standard.

The OptList constant returns a blessed type constraint object. is_OptList($value) checks a value against the type and returns a boolean. 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 );

Optional

Based on Optional in Types::Standard.

The Optional constant returns a blessed type constraint object. is_Optional($value) checks a value against the type and returns a boolean. 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 );

Overload

Based on Overload in Types::Standard.

The Overload constant returns a blessed type constraint object. is_Overload($value) checks a value against the type and returns a boolean. 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 );

Password

Based on Password in Types::Common::String.

The Password constant returns a blessed type constraint object. is_Password($value) checks a value against the type and returns a boolean. 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 );

PositiveInt

Based on PositiveInt in Types::Common::Numeric.

The PositiveInt constant returns a blessed type constraint object. is_PositiveInt($value) checks a value against the type and returns a boolean. 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 );

PositiveNum

Based on PositiveNum in Types::Common::Numeric.

The PositiveNum constant returns a blessed type constraint object. is_PositiveNum($value) checks a value against the type and returns a boolean. 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 );

PositiveOrZeroInt

Based on PositiveOrZeroInt in Types::Common::Numeric.

The PositiveOrZeroInt constant returns a blessed type constraint object. is_PositiveOrZeroInt($value) checks a value against the type and returns a boolean. 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 );

PositiveOrZeroNum

Based on PositiveOrZeroNum in Types::Common::Numeric.

The PositiveOrZeroNum constant returns a blessed type constraint object. is_PositiveOrZeroNum($value) checks a value against the type and returns a boolean. 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 );

Ref

Based on Ref in Types::Standard.

The Ref constant returns a blessed type constraint object. is_Ref($value) checks a value against the type and returns a boolean. 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 );

RegexpRef

Based on RegexpRef in Types::Standard.

The RegexpRef constant returns a blessed type constraint object. is_RegexpRef($value) checks a value against the type and returns a boolean. 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 );

RoleName

Based on RoleName in Types::Standard.

The RoleName constant returns a blessed type constraint object. is_RoleName($value) checks a value against the type and returns a boolean. 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 );

ScalarRef

Based on ScalarRef in Types::Standard.

The ScalarRef constant returns a blessed type constraint object. is_ScalarRef($value) checks a value against the type and returns a boolean. 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 );

Set

Based on Set in Acme::Mitey::Cards::Types::Source.

The Set constant returns a blessed type constraint object. is_Set($value) checks a value against the type and returns a boolean. 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 );

SimpleStr

Based on SimpleStr in Types::Common::String.

The SimpleStr constant returns a blessed type constraint object. is_SimpleStr($value) checks a value against the type and returns a boolean. 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 );

SingleDigit

Based on SingleDigit in Types::Common::Numeric.

The SingleDigit constant returns a blessed type constraint object. is_SingleDigit($value) checks a value against the type and returns a boolean. 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 );

Slurpy

Based on Slurpy in Types::Standard.

The Slurpy constant returns a blessed type constraint object. is_Slurpy($value) checks a value against the type and returns a boolean. 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 );

Str

Based on Str in Types::Standard.

The Str constant returns a blessed type constraint object. is_Str($value) checks a value against the type and returns a boolean. 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 );

StrLength

Based on StrLength in Types::Common::String.

The StrLength constant returns a blessed type constraint object. is_StrLength($value) checks a value against the type and returns a boolean. 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 );

StrMatch

Based on StrMatch in Types::Standard.

The StrMatch constant returns a blessed type constraint object. is_StrMatch($value) checks a value against the type and returns a boolean. 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 );

StrictNum

Based on StrictNum in Types::Standard.

The StrictNum constant returns a blessed type constraint object. is_StrictNum($value) checks a value against the type and returns a boolean. 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 );

StrongPassword

Based on StrongPassword in Types::Common::String.

The StrongPassword constant returns a blessed type constraint object. is_StrongPassword($value) checks a value against the type and returns a boolean. 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 );

Suit

Based on Suit in Acme::Mitey::Cards::Types::Source.

The Suit constant returns a blessed type constraint object. is_Suit($value) checks a value against the type and returns a boolean. 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 );

Tied

Based on Tied in Types::Standard.

The Tied constant returns a blessed type constraint object. is_Tied($value) checks a value against the type and returns a boolean. 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 );

Tuple

Based on Tuple in Types::Standard.

The Tuple constant returns a blessed type constraint object. is_Tuple($value) checks a value against the type and returns a boolean. 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 );

Undef

Based on Undef in Types::Standard.

The Undef constant returns a blessed type constraint object. is_Undef($value) checks a value against the type and returns a boolean. 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 );

UpperCaseSimpleStr

Based on UpperCaseSimpleStr in Types::Common::String.

The UpperCaseSimpleStr constant returns a blessed type constraint object. is_UpperCaseSimpleStr($value) checks a value against the type and returns a boolean. 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 );

UpperCaseStr

Based on UpperCaseStr in Types::Common::String.

The UpperCaseStr constant returns a blessed type constraint object. is_UpperCaseStr($value) checks a value against the type and returns a boolean. 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 );

Value

Based on Value in Types::Standard.

The Value constant returns a blessed type constraint object. is_Value($value) checks a value against the type and returns a boolean. 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 );

TYPE CONSTRAINT METHODS

For any type constraint 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 assert_return.

The objects as-is can be used in Moo or Mite isa options.

 has myattr => (
   is => 'rw',
   isa => Foo,
 );

They cannot be used as-is in Moose or Mouse, but can be promoted to Type::Tiny and will then work:

 has myattr => (
   is => 'rw',
   isa => Foo->to_TypeTiny,
 );