NAME Class::Params - Parameter utils for constructor. SYNOPSIS use Class::Params qw(params); params($self, $def_hr, $params_ar); DEFINITION FORMAT There is hash with parameters. internal_name => [real_name, possible_types, requirement] Example: 'par1' => ['_par1', 'SCALAR', 1], 'par2' => ['_par2', ['SCALAR', 'HASH'], 0], 'par3' => ['_par3', ['SCALAR', 'Class'], 0], SUBROUTINES "params($self, $def_hr, $params_ar)" Check for structure over definition and save input data to $self. Parameters: $self - Structure, for data save. $def_hr - Definition hash ref. $params_ar - Reference to array of key-value pairs. Returns undef. ERRORS params(): Bad parameter '%s' type. Parameter '%s' is required. Unknown parameter '%s'. EXAMPLE1 # Pragmas. use strict; use warnings; # Modules. use Class::Params qw(params); # Definition. my $self = {}; my $def_hr = { 'par' => ['par', 'SCALAR', 1], }; # Check. # output_structure, definition, array of pairs (key, value). params($self, $def_hr, ['bad_par', 1]); # Output: # Unknown parameter 'bad_par'. EXAMPLE2 # Pragmas. use strict; use warnings; # Modules. use Class::Params qw(params); use Data::Printer; # Definition. my $self = {}; my $def_hr = { 'par' => ['par', 'SCALAR', 1], }; # Check. # output_structure, definition, array of pairs (key, value). params($self, $def_hr, ['par', 1]); # Dump $self. p $self; # Output: # \ { # par 1 # } DEPENDENCIES Error::Pure, Exporter, Readonly, Scalar::Util. REPOSITORY AUTHOR Michal Špaček skim@cpan.org LICENSE AND COPYRIGHT BSD license. VERSION 0.02