HTML::CheckArgs

HTML::CheckArgs module can validate data passed to web applications.
Download

HTML::CheckArgs Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Eric Folley
  • Publisher web site:
  • http://search.cpan.org/~efolley/HTML-CheckArgs-0.11/lib/HTML/CheckArgs.pm

HTML::CheckArgs Tags


HTML::CheckArgs Description

HTML::CheckArgs module can validate data passed to web applications. HTML::CheckArgs module can validate data passed to web applications.SYNOPSIS use HTML::CheckArgs; my @banned_domains = ( 'whitehouse.gov', 'gop.com' ); my $config = { email_address => { as => 'email', required => 1, label => 'Email Address', order => 1, params => { banned_domains => @banned_domains }, }, num_tickets => { as => 'integer', required => 1, label => 'Number of Tickets', order => 2, params => { min => 0, max => 10 }, }, }; my $handler = HTML::CheckArgs->new( $config ); my ( $error_message, $error_code ); foreach my $field ( sort { $config->{$a}{order} $config->{$b}{order} } keys %$config ) { if ( $handler->validate( $field, $ARGS{$field} ) ) { $ARGS{$field} = $handler->value; } else { push( @$error_message, $handler->error_message ); push( @$error_code, $handler->error_code ); } }HTML::CheckArgs validates data passed to web applications. Architecturally, it is based on CGI::Untaint, and we follow that model of extensibility as well.Most of the work is done in the $config hashref. $config's keys are the fieldnames to be validated. The following parameters can be passed in:as:Name of the module that should be used to validate the data. The following modules are available:cc_expirationPassed a date string in the format YYYYMM, will determine if the string is valid, and if the date is in the future.cc_numberValidates credit card numbers based on Luhn checksum.countryValidates 2-character country code or full country name per Georgraphy::Countries.datePassed a date string, a format, and a regex of the format, will determine if the string represents a valid date.dollarValidates a dollar figure. Can optionally specify minimum and maximum vaues to check against.emailUses Email::Valid to check email addresses. Can optionally specify no administrative addresses (e.g. root@domain.com), no government addresses (me@dot.gov), or no addresses from a list of domains passed to the module.integerDetermines if number is a valid interger. Can optionally specify minimum and maximum values to check against.optionDetermines if a value is a member of a list passed to the module. Useful when the form input is a select or a radio button.phoneDetermines if a string is valid phone number. Only does strict validation on US phone numbers, but other formats could be included.postal_codeValidates a postal or ZIP code. Only does strict validation on US ZIP codes.stateValidates a two-character state abbrieviation or full name. Only does strict validation on US values.stringA catch-all class. Can format the string per the routines in HTML::FormatData, and can also do regex checks, checks on the number of character, number of words, etc.urlUses URL::Find to validate the URL. Can optionally check the URL via LWP::UserAgent. Requirements: · Perl


HTML::CheckArgs Related Software