FormMagick::Validator - validate data from FormMagick forms
SYNOPSIS
use FormMagick::Validator;
DESCRIPTION
This module provides some common validation routines. Validation routines return the string "OK" if they succeed, or a descriptive message if they fail.
Validation routines provided:
- nonblank
-
The data is not an empty string :
$data ne "" - number
-
The data is a number (strictly speaking, data is a positive number):
$data =~ /^[0-9.]+$/ - word
-
The data looks like a single word:
$data !~ /\W/ - minlength(n)
-
The data is at least
ncharacters long:length($data) >= $n - maxlength(n)
-
The data is no more than
ncharacters long:length($data) <= $n - exactlength(n)
-
The data is exactly
ncharacters long:length($data) E== $n - lengthrange(n,m)
-
The data is between
nand c<m> characters long:length($data) >= $nandlength($data) <= $m. - url
-
The data looks like a (normalish) URL:
$data =~ m!(http|ftp)://[\w/.-/)! -
The data looks more or less like an internet email address:
$data =~ /\@/Note: not fully compliant with the entire gamut of RFC 822 addressing ;)
- domain_name
-
The data looks like an internet domain name or hostname.
- ip_number
-
The data looks like a valid IP number.
- username
-
The data looks like a good, valid username
- password
-
The data looks like a good password
- date
-
The data looks like a date.
- iso_country_code
-
The data is a standard 2-letter ISO country code. Uses Locale::Country to check.
- US_state
-
The data is a standard 2-letter US state abbreviation. Uses Geography::State in non-strict mode.
- US_zipcode
-
The data looks like a valid US zipcode
- credit_card_type
-
The data looks like a valid type of credit card (eg Visa, Mastercard). Uses Business::CreditCard.
- credit_card_number
-
The data looks like a valid credit card number Uses Business::CreditCard.
- credit_card_expiry
-
The data looks like a valid credit card expiry date Uses Business::CreditCard.
These validation routines may be overridden and others may be added on a per-application basis. To do this, simply define a subroutine in your CGI script that works in a similar way and use its name in the VALIDATION attribute in your XML.
AUTHOR
Kirrily "Skud" Robert <skud@infotrope.net>
More information about FormMagick may be found at http://sourceforge.net/projects/formmagick/
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 16:
=pod directives shouldn't be over one line long! Ignoring all 2 lines of content