use Types::Standard qw( Int );
if ( not Int->check($var) ) {
die "It's supposed to be an integer!\n";
}
####
use Types::Standard qw( Int );
Int->assert_valid($var);
####
use Types::Standard qw( Object Num );
sub transfer_money {
my $from_account = Object->assert_return( shift );
my $to_account = Object->assert_return( shift );
my $amount = Num->assert_return( shift );
...;
}
####
use feature qw( state ); # enable the `state` feature from Perl 5.10+
use Types::Standard qw( Object Num );
use Type::Params qw( compile );
sub transfer_money {
state $check = compile( Object, Object, Num );
my ($from_account, $to_account, $amount) = $check->(@_);
...;
}
####
perl -MTypes::Standard=-all -le'print Int->inline_check(q($val))'