Params::Profile

Params::Profile is a Perl module for registering Parameter profiles.
Download

Params::Profile Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Michiel Ootjers
  • Publisher web site:
  • http://search.cpan.org/~michiel/Params-Profile-0.10/lib/Params/Profile.pm

Params::Profile Tags


Params::Profile Description

Params::Profile is a Perl module for registering Parameter profiles. Params::Profile is a Perl module for registering Parameter profiles.SYNOPSIS package Foo::Bar; use Params::Profile; ### Single profile Params::Profile->register_profile( 'method' => 'subroto', 'profile' => { testkey1 => { required => 1 }, testkey2 => { required => 1, allow => qr/^d+$/, }, testkey3 => { allow => qr/^w+$/, }, }, ); sub subroto { my (%params) = @_; return unlesss Params::Profile->validate('params' => %params); ### DO SOME STUFF HERE ... } my $profile = Params::Profile->get_profile('method' => 'subroto'); ### Multiple Profile Params::Profile->register_profile( 'method' => 'subalso', 'profile' => , ); sub subalso { my (%params) = @_; ### Checks parameters agains profile of subroto and above registered ### profile return unlesss Params::Profile->validate('params' => %params); ### DO SOME STUFF HERE ... }Params::Profile provides a mechanism for a centralised Params::Check or a Data::FormValidater profile. You can bind a profile to a class::subroutine, then, when you are in a subroutine you can simply call Params::Profile->check($params) of Params::Profile->validate($params) to validate against this profile. Validate will return true or false on successfull or failed validation. Check will return what Data::FormValidator or Params::Check would return. (For Params::Check this is simply a hash with the validated parameters , for Data::FormValidator, this is a Data::FormValidator::Results object)Requirements:· Perl Requirements: · Perl


Params::Profile Related Software