CGI::Validate
Details
| Size: | 9K |
| Last Update: | 2008-05-13 22:14:59 |
| Version: | 2.000 |
| OS Support: | Linux |
| License/Program Type: | Perl Artistic License |
| Publisher: | Byron Brummer |
| Price: | $0.00 |
Description:
CGI::Validate 2.000 is libraries software developed by Byron Brummer.
CGI::Validate is an advanced CGI form parser and type validation.
SYNOPSIS
use CGI::Validate; GetFormData() only
use CGI::Validate qw(:standard); Normal use
use CGI::Validate qw(:subs); Just functions
use CGI::Validate qw(:vars); Just exception vars
If you don't want it to check that every requested
element arrived you can use this. But I don't recommend it
for most users.
$CGI::Validate::Complete = 0;
If you don't care that some fields in the form don't
actually match what you asked for. -I don't recommend
this unless you REALLY know what you're doing because this
normally meens you've got typo's in your HTML and we can't
catch them if you set this.
$CGI::Validate::IgnoreNonMatchingFields = 1;
my $FieldOne = 'Default String';
my $FieldTwo = 8;
my $FieldThree = 'some default string';
my @FieldFour = (); For multi-select field
my @FieldFive = (); Ditto
my $EmailAddress= '';
Try...
my $Query = GetFormData (
'FieldOne=s' => $FieldOne, Required string
'FieldTwo=i' => $FieldTwo, Required int
'FieldThree' => $FieldThree, Auto converted to the ":s" type
'FieldFour=s' => @FieldFour, Multi-select field of strings
'FieldFive=f' => @FieldFive, Multi-select field of floats
'Email=e' => $EmailAddress, Must 'look' like an email address
) or do {
Catch... (wouldn't you just love a case statement here?)
if (%Missing) {
die "Missing form elements: " . join (' ', keys %Missing);
} elsif (%Invalid) {
die "Invalid form elements: " . join (' ', keys %Invalid);
} elsif (%Blank) {
die "Blank form elements: " . join (' ', keys %Blank);
} elsif (%InvalidType) {
die "Invalid data types for fields: " . join (' ', keys %InvalidType);
} else {
die "GetFormData() exception: $CGI::Validate::Error";
}
};
If you only want to check the form data, but don't want to
have CGI::Validate set anything use this. -You still have full
access to the data via the normal B object that is returned.
use CGI::Validate qw(CheckFormData); not exported by default
my $Query = CheckFormData (
'FieldOne=s', 'FieldTwo=i', 'FieldThree', 'FieldFour',
'FieldFive', 'Email',
) or do {
... Same exceptions available as GetFormData above ...
};
Need some of your own validation code to be used? Here is how you do it.
addExtensions (
myType => sub { $_[0] =~ /test/ },
fooBar => &fooBar,
i_modify_the_actual_data => sub {
if ($_[0] =~ /test/) { data validation
$_[0] = 'whatever'; modify the data by alias
return 1;
} else {
return 0;
}
},
);
my $Query = GetFormData (
'foo=xmyType' => $foo,
'bar=xfooBar' => $bar,
'cat=xi_modify_the_actual_data' => $cat,
);
Builtin data type checks available are:
s string Any non-zero length value
w word Must have at least one w char
i integer Integer value
f float Float value
e email Must match m/^s
CGI::Validate 2.000 supports english interface languages and works with Linux.
Downloading CGI::Validate 2.000 will take several seconds if you use fast ADSL connection.
0 comments
Add to
CGI::Validate Version History
Related Software
|
|
From category: Libraries |
| Bigtop::Docs::TentTut 0.14 is libraries software developed by Phil Crow. Bigtop::Docs::TentTut is Perl module for tentmaker Tutorial (best viewed in html). If you don\'t know what Bigtop is,... |
|
|
From category: Libraries |
| Database Primitives Library 1.0.0 is libraries software developed by Kevin L. Mitchell. DBPrim project is a library providing basic building blocks for creating in-memory databases. Here are... |
|
|
From category: Compilers |
| SleekIce is an easy to use game engine used to write games in Java.... |
|
|
From category: Libraries |
| commonc++ is a C++ class library for developing cross-platform systems software for POSIX and Windows systems.... |
|
|
From category: Code-Generators |
| CodeWorker 4.2 is code generators software developed by CodeWorker. CodeWorker is a versatile Open Source, licensed under GNU Lesser General Public License, parsing tool and a source code generator... |
|
|
From category: Version-Control |
| Blame 1.3.1 is version control software developed by Michael Chapman. Blame displays the last modification for each line in an RCS file. Blame is the RCS equivalent of CVS&039;s annotate command.\... |
|
|
From category: Assembler-Tools |
| Boo 0.7 is assembler tools software developed by Boo Team. Boo is a new object oriented statically typed programming language for the Common Language Infrastructure with a python inspired syntax an... |
|
|
From category: Libraries |
| Apache::MP3::Skin 0.91 is libraries software developed by Robert Graff. Apache::MP3::Skin is a subclass of Apache::MP3::Playlist with the ability to \"skin\" the output using HTML::Template. \... |
|
|
From category: Bug-Tracking |
| Bugzilla 2.23.3 is bug tracking software developed by The Mozilla Organization. Bugzilla project is server software designed to help you manage software development. Bugzilla is a \"Defect T... |
|
|
From category: Libraries |
| euCatalogue 1.2 Beta is libraries software developed by Markos Charatzas. euCatalogue is a catalogue framework in Java to help you build a generic catalogue structure. euCatalogue includes a... |
|
|
From category: Libraries |
| DBIx::DataModel 0.21 is libraries software developed by Laurent Dami. DBIx::DataModel is a Perl module with Classes and UML-style Associations on top of DBI. SYNOPSIS in file \"MySche... |
|
|
From category: Libraries |
| MyPerlCrap is meant to simulate playing the field at a craps table.... |
|
|
From category: Libraries |
| Class::Tangram 1.57 is libraries software developed by Sam Vilain. Class::Tangram is a Perl module for tangram-friendly classes, DWIM attributes. SYNOPSIS package MyObject; u... |
|
|
From category: Libraries |
| Bellagio OpenMAX IL Implementation 0.2 is libraries software developed by STMicroelectronics. Bellagio is a sample implementation of OpenMAX IL for Linux. It enables software developers and... |
|
|
From category: Compilers |
| ccache 2.4 is compilers software developed by Andrew Tridgell. ccache is a compiler cache. It acts as a caching pre-processor to C/C++ compilers, using the -E compiler switch and a hash to detect w... |
Leave a comment