Params::CheckA generic input parsing/checking mechanism | |
Download |
Params::Check Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Jos Boumans
- Publisher web site:
- http://search.cpan.org/~kane/
Params::Check Tags
Params::Check Description
A generic input parsing/checking mechanism Params::Check is a Perl module, a generic input parsing/checking mechanism.It allows you to validate input via a template. The only requirement is that the arguments must be named.Params::Check can do the following things for you: * Convert all keys to lowercase * Check if all required arguments have been provided * Set arguments that have not been provided to the default * Weed out arguments that are not supported and warn about them to the user * Validate the arguments given by the user based on strings, regexes, lists or even subroutines * Enforce type integrity if requiredSYNOPSIS use Params::Check qw; sub fill_personal_info { my %hash = @_; my $x; my $tmpl = { firstname => { required => 1, defined => 1 }, lastname => { required => 1, store => \$x }, gender => { required => 1, allow => , }, married => { allow => }, age => { default => 21, allow => qr/^\d+$/, }, phone => { allow => }, id_list => { default => [], strict_type => 1 }, employer => { default => 'NSA', no_override => 1 }, }; ### check() returns a hashref of parsed args on success ### my $parsed_args = check( $tmpl, \%hash, $VERBOSE ) or die qw; ... other code here ... } my $ok = allow( $colour, ); my $error = Params::Check::last_error(); Requirements: · Perl
Params::Check Related Software