Skip to content

vanHoesel/perl5-type-params-validation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Type::Params::Validation

Type::Params Validation for all named params

  • Because Type::Params is cool and has a simple syntax.
  • Because Type::Tiny is a cool type-system.
  • Because Type::Params does not tell what else might have gone wrong

SYNOPSIS

use v5.10;
use strict;
use warnings;
 
use Type::Params::Validatoin qw( compile_named );
use Types::Standard qw( slurpy Str ArrayRef Num );
   
sub deposit_monies
{
   state $check = compile_named(
      sort_code      => Str,
      account_number => Str,
      monies         => ArrayRef[Num],
   );
   my $args = $check->(@_);
    
   my $account = Local::BankAccount->new($args->{sort_code}, $args->{account_number});
   $account->deposit($_) for @{$args->{monies}};
}
 
deposit_monies(
   sort_code      => "12-34-56",
   account_number => "11223344",
   monies         => [ 1.2, 3, 99.99 ],
);

About

Type::Params Validation for all named params

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages