Data::...lidator(3pm)
β¨ Data::FormValidator β¨
okay bestie so this is the Data::FormValidator(3pm) page from the User Contributed Perl Documentation, and it's genuinely iconic, fr fr. π
π NAME π
Data::FormValidator β validates user input (usually from an HTML form) based on input profile. that's the whole vibe. π¦
π SYNOPSIS π
use Data::FormValidator;
my $results = Data::FormValidator->check(\%input_hash, \%dfv_profile);
if ($results->has_invalid or $results->has_missing) {
# do something with $results->invalid, $results->missing
# or $results->msgs
}
else {
# do something with $results->valid
}
π DESCRIPTION π
Bestie, listen. The main aim of Data::FormValidator is to make input validation expressible in a simple format. That's it. That's the goal. π«Ά
It lets you define profiles which declare the required and optional fields and any constraints they might have.
And the results come back as an object, which makes it easy to handle missing and invalid results, return error messages about which constraints failed, or process the resulting valid data. main character energy honestly. π
π VALIDATING INPUT π
check()
my $results = Data::FormValidator->check(\%input_hash, \%dfv_profile);
check is the recommended method to use to validate forms, periodt. It returns its results as a Data::FormValidator::Results object. A deprecated method validate (described below) is also available, returning its results as an array.
use Data::FormValidator;
my $results = Data::FormValidator->check(\%input_hash, \%dfv_profile);
Here, check() is used as a class method, and it takes two required parameters.
The first one is a reference to the data to be validated. This can either be a hash reference, or a CGI.pm-like object. In particular, the object must have a param() method that works like the one in CGI.pm does. CGI::Simple and Apache::Request objects are known to work in particular. π Note that if you use a hash reference, multiple values for a single key should be presented as an array reference.
The second argument is a reference to the profile you are validating.
validate()
my( $valids, $missings, $invalids, $unknowns ) =
Data::FormValidator->validate( \%input_hash, \%dfv_profile);
validate() provides a deprecated alternative to check(). Same input syntax, but it returns a four element array, described as follows:
- valids β this is a hash reference to the valid fields which were submitted in the data. The data may have been modified by the various filters specified. β¨
- missings β this is a reference to an array which contains the name of the missing fields. Those are the fields that the user forgot to fill or filled with spaces. These fields may come from the required list or the dependencies list. π
- invalids β this is a reference to an array which contains the name of the fields which failed one or more of their constraint checks. If there are no invalid fields, an empty arrayref will be returned. Fields defined with multiple constraints will have an array ref returned in the
@invalidsarray instead of a string. The first element in this array is the name of the field, and the remaining fields are the names of the failed constraints. - unknowns β this is a list of fields which are unknown to the profile. Whether or not this indicates an error in the user input is application dependent. π€·
new()
Using new() is only needed for advanced usage, including these cases:
- Loading more than one profile at a time. Then you can select the profile you want by name later with
check(). Here's an example:
my $dfv = Data::FormValidator->new({
profile_1 => { # usual profile definition here },
profile_2 => { # another profile definition },
});
As illustrated, multiple profiles are defined through a hash ref whose keys point to profile definitions.
You can also load several profiles from a file, by defining several profiles as shown above in an external file. Then just pass in the name of the file:
my $dfv = Data::FormValidator->new('/path/to/profiles.pl');
If the input profile is specified as a file name, the profiles will be reread each time that the disk copy is modified. π₯
Now when calling check(), you just need to supply the profile name:
my $results = $dfv->check(\%input_hash,'profile_1');
- Applying defaults to more than one input profile. There are some parts of the validation profile that you might like to re-use for many form validations.
To facilitate this, new() takes a second argument, a hash reference. Here the usual input profile definitions can be made. These will act as defaults for any subsequent calls to check() on this object.
Currently the logic for this is very simple. Any definition of a key in your validation profile will completely overwrite your default value.
This means you can't define two keys for constraint_regexp_map and expect they will always be there. This kind of feature may be added in the future. (manifesting it for them) πΈ
The exception here is definitions for your msgs key. You will safely be able to define some defaults for the top level keys within msgs and not have them clobbered just because msgs was defined in a validation profile.
One way to use this feature is to create your own sub-class that always provides your defaults to new().
Another option is to create your own wrapper routine which provides these defaults to new(). Here's an example of a routine you might put in a CGI::Application super-class to make use of this feature:
# Always use the built-in CGI object as the form data
# and provide some defaults to new constructor
sub check_form {
my $self = shift;
my $profile = shift
|| die 'check_form: missing required profile';
require Data::FormValidator;
my $dfv = Data::FormValidator->new({},{
# your defaults here
});
return $dfv->check($self->query,$profile);
}
π INPUT PROFILE SPECIFICATION π
An input profile is a hash reference containing one or more of the following keys.
Here is a very simple input profile. Examples of more advanced options are described below.
use Data::FormValidator::Constraints qw(:closures);
my $profile = {
optional => [qw( company
fax
country )],
required => [qw( fullname
phone
email
address )],
constraint_methods => {
email => email(),
}
};
That defines some fields as optional, some as required, and defines that the field named 'email' must pass the constraint named 'email'. simple, clean, slay β¨
Here is a complete list of the keys available in the input profile, with examples of each. π«Ά
required
This is an array reference which contains the name of the fields which are required. Any fields in this list which are not present or contain only spaces will be reported as missing. π΅οΈ
required_regexp
required_regexp => qr/city|state|zipcode/,
This is a regular expression used to specify additional field names for which values will be required.
require_some
require_some => {
# require any two fields from this group
city_or_state_or_zipcode => [ 2, qw/city state zipcode/ ],
}
This is a reference to a hash which defines groups of fields where 1 or more fields from the group should be required, but exactly which fields doesn't matter. The keys in the hash are the group names. These are returned as "missing" unless the required number of fields from the group has been filled in. The values in this hash are array references. The first element in this array should be the number of fields in the group that is required. If the first field in the array is not an a digit, a default of "1" will be used. π
optional
optional => [qw/meat coffee chocolate/],
This is an array reference which contains the name of optional fields. These are fields which MAY be present and if they are, they will be checked for valid input. Any fields not in optional or required list will be reported as unknown. π
optional_regexp
optional_regexp => qr/_province$/,
This is a regular expression used to specify additional fields which are optional. For example, if you wanted all fields names that begin with user_ to be optional, you could use the regular expression, /^user_/
dependencies
dependencies => {
# If cc_no is entered, make cc_type and cc_exp required
"cc_no" => [ qw( cc_type cc_exp ) ],
# if pay_type eq 'check', require check_no
"pay_type" => {
check => [ qw( check_no ) ],
}
# if cc_type is VISA or MASTERCARD require CVV
"cc_type" => sub {
my $dfv = shift;
my $type = shift;
return [ 'cc_cvv' ] if ($type eq "VISA" || $type eq "MASTERCARD");
return [ ];
},
},
This is for the case where an optional field has other requirements. The dependent fields can be specified with an array reference.
If the dependencies are specified with a hash reference then the additional constraint is added that the optional field must equal a key for the dependencies to be added.
If the dependencies are specified as a code reference then the code will be executed to determine the dependent fields. It is passed two parameters, the object and the value of the field, and it should return an array reference containing the list of dependent fields. π§
Any fields in the dependencies list that are missing when the target is present will be reported as missing.
dependency_groups
dependency_groups => {
# if either field is filled in, they all become required
password_group => [qw/password password_confirmation/],
}
This is a hash reference which contains information about groups of interdependent fields. The keys are arbitrary names that you create and the values are references to arrays of the field names in each group. π
dependencies_regexp
dependencies_regexp => {
qr/Line\d+\_ItemType$/ => sub {
my $dfv = shift;
my $itemtype = shift;
my $field = shift;
if ($type eq 'NeedsBatteries') {
my ($prefix, $suffix) = split(/\_/, $field);
return([$prefix . '_add_batteries]);
} else {
return([]);
}
},
},
This is a regular expression that names extra fields which are dependent β like, fields that only matter if some other field showed up. Example vibe: a shopping cart where you have no clue in advance how many items there are gonna be, but you still want all their dependency rules handled. πβ¨
π dependent_optionals π
dependent_optionals => {
# If delivery_address is specified then delivery_notes becomes optional
"delivery_address" => [ qw( delivery_notes ) ],
# if delivery_type eq 'collection', collection_notes becomes optional
"delivery_type" => {
collection => [ qw( collection_notes ) ],
}
# if callback_type is "phone" or "email" then additional_notes becomes optional
"callback_type" => sub {
my $dfv = shift;
my $type = shift;
if ($type eq 'phone' || $type eq 'email') {
return(['additional_notes']);
} else {
return([]);
}
},
},
okay so this is for when an optional field is allowed to trigger other optional fields. iconic behavior tbh. π
You can hand over the dependent optional fields as an array reference. easy.
If you give them as a hash reference instead, then there's an extra rule stacked on top: the optional field has to be equal to a key for those extra optional fields to get added. like a little membership check, slay.
And if you pass a code reference? then that code gets run to figure out which extra optional fields apply. It gets passed two parameters β the object, and the value of the field β and it should return an array reference holding the list of additional optional fields. no cap. π«Ά
πΈ dependent_require_some πΈ
dependent_require_some => {
# require any fields from this group if AddressID is "new"
AddressID => sub {
my $dfv = shift;
my $value = shift;
if ($value eq 'new') {
return({
house_name_or_number => [ 1, 'HouseName', 'HouseNumber' ],
});
} else {
return;
}
},
}
Sometimes a field needs to trigger extra dependencies, but you only require some of the fields. You literally cannot set them all as dependent, because you might only have a few of them. And you can't set them all as optional either, because you must have some of them. π This method lets you say exactly that, in a way that's a lot like the equire_some method but dependent on other values.
In the example up there, if the submitted AddressID is "new", then at least 1 of HouseName and HouseNumber has to be supplied too. For the valid options on what you can return, go peek at require_some. π
β defaults β
defaults => {
country => "USA",
},
A hash reference where the keys are field names and the values are the defaults to use when the input for that field is missing. π
The values can be code refs, which get used to calculate the value if it's needed. Those code refs get passed the DFV::Results object as their only parameter.
Defaults get set shortly before the constraints are applied, and they come back with the rest of the valid data. periodt. β¨
π¦ defaults_regexp_map π¦
defaults_regexp_map => {
qr/^opt_/ => 1,
},
A hash reference mapping regular expressions to default values, for matching optional or required fields. π
It's genuinely so useful if you've generated a whole bunch of checkbox fields with similar names β because checkbox fields submit nothing at all when they're not checked, so defaults for them are chef's kiss.
Heads up bestie: it does not make sense to use a default for a field that's handled byoptional_regexporrequired_regexp. When the field isn't submitted, there is no way to know it should be optional or required, so there's no way to know a default should be set for it either. π
π filters π
# trim leading and trailing whitespace on all fields
filters => ['trim'],
A reference to an array of filters that get applied to ALL optional and required fields, before any constraints are applied. β¨
Each entry can be the name of a built-in filter (trim, digit, etc) or an anonymous subroutine. The sub takes one parameter β the field value β and returns the (possibly) modified value. π«Ά
Filters modify the data returned through the results object, so use them carefully. π³
For the deets on the built-in filters, see Data::FormValidator::Filters. π
π field_filters π
field_filters => {
cc_no => ['digit'],
},
A hash ref with field names as keys. The values are array references of built-in filters to apply (trim, digit, etc), or an anonymous subroutine that takes one parameter β the field value β and returns the (possibly) modified value. πΈ
Filters get applied before any constraints are applied. π
See Data::FormValidator::Filters for the built-in filter lore.
β¨ field_filter_regexp_map β¨
field_filter_regexp_map => {
# Upper-case the first letter of all fields that end in "_name"
qr/_name$/ => ['ucfirst'],
},
field_filter_regexp_map applies filters to fields that match a regular expression. It's a hash reference where the keys are the regexes to use, and the values are references to arrays of filters that get applied to specific input fields. Just like with field_filters, you can use a built-in filter or a coderef to supply your own. π
π constraint_methods π
use Data::FormValidator::Constraints qw(:closures);
constraint_methods => {
cc_no => cc_number({fields => ['cc_type']}),
cc_type => cc_type(),
cc_exp => cc_exp(),
},
A hash ref holding the constraints used to check whether a field contains valid data or not. π₯
Note: to use the built-in constraints, they need to be loaded into your name space first, using the syntax above. (Unless you're using the old constraints key β that one's documented in "BACKWARDS COMPATIBILITY".)
The keys in this hash are field names. The values can be any of the following:
- A named constraint.
Example:
my_zipcode_field => zip(),
See Data::FormValidator::Constraints for the details of which built-in constraints are available.
- A perl regular expression
Example:
my_zipcode_field => qr/^\d{5}$/, # match exactly 5 digits
If this field is named in untaint_constraint_fields or untaint_regexp_map, or untaint_all_constraints is effective, then be aware of this: if you write your own regular expressions and only match part of the string, you'll only get part of the string in the valid hash. So it's a good idea to write your own constraints like /^regex$/ β that way you match the whole string. no half measures bestie π
- a subroutine reference, to supply custom code
This checks the input and returns true or false depending on whether the input's valid. By default, the constraint function receives a Data::FormValidator::Results object as its first argument, and the value to be validated as the second. To validate a field based on more inputs than just the field itself, see "VALIDATING INPUT BASED ON MULTIPLE FIELDS".
Examples:
# Notice the use of 'pop'--
# the object is the first arg passed to the method
# while the value is the second, and last arg.
my_zipcode_field => sub { my $val = pop; return $val =~ '/^\d{5}$/' },
# OR you can reference a subroutine, which should work like the one above
my_zipcode_field => \&my_validation_routine,
# An example of setting the constraint name.
my_zipcode_field => sub {
my ($dfv, $val) = @_;
$dfv->set_current_constraint_name('my_constraint_name');
return $val =~ '/^\d{5}$/'
},
- an array reference
An array reference is used to apply multiple constraints to a single field. Any of the options above are valid entries in the array. See "MULTIPLE CONSTRAINTS" below.
For more details see "VALIDATING INPUT BASED ON MULTIPLE FIELDS".
π constraint_method_regexp_map π
use Data::FormValidator::Constraints qw(:closures);
# In your profile.
constraint_method_regexp_map => {
# All fields that end in _postcode have the 'postcode' constraint applied.
qr/_postcode$/ => postcode(),
},
A hash ref where the keys are the regular expressions to use and the values are the constraints to apply. π¦
If one or more constraints have already been defined for a given field using constraint_methods, then constraint_method_regexp_map adds an additional constraint for that field for each regular expression that matches. stacking them like bracelets fr fr π
π₯ untaint_all_constraints π₯
untaint_all_constraints => 1,
If this field is set, all form data that passes a constraint will be untainted. The untainted data gets returned in the valid hash. Untainting is based on the pattern match used by the constraint. Note that some constraint routines may not provide untainting. π
See Writing your own constraint routines for more info.
This gets overridden byuntaint_constraint_fieldsanduntaint_regexp_map.
π untaint_constraint_fields π
untaint_constraint_fields => [qw(zipcode state)],
Says that one or more fields will be untainted if they pass their constraint(s). You can set this to a single field name or an array reference of field names. The untainted data gets returned in the valid hash. β¨
This overrides the untaint_all_constraints flag.
π untaint_regexp_map π
untaint_regexp_map => [qr/some_field_\d/],
Says that certain fields will be untainted if they pass their constraints and match one of the regular expressions you supplied. You can set this to a single regex, or an array reference of regexes. The untainted data gets returned in the valid hash. π«Ά
The example above would untaint the fields named some_field_1 and some_field_2, but not some_field. π
This overrides the untaint_all_constraints flag.
π missing_optional_valid π
missing_optional_valid => 1
Set this to a true value and optional fields with empty values get included in the valid hash. By default they are not included β that's the historical behavior. π
This is a big deal of a flag if you're using the contents of an update form to update a record in a database. Without this option, fields that have been set back to "blank" may fail to get updated. π
π§ validator_packages π§
# load all the constraints and filters from these modules
validator_packages => [qw(Data::FormValidator::Constraints::Upload)],
(and the page keeps going, bestie β more coming π)
bestie this key is the plug for pulling in other packages that hold constraint routines or filters π«Ά Set it to one single package name, or to an arrayref if you've got several. Every constraint and filter routine in there that starts with 'match_', 'valid_' or 'filter_' gets imported into Data::FormValidator, so you can call them in a constraint by their name alone β literally just like the built-in routines π And yes, you can even override the provided validators. Iconic.
See the Writing your own constraint routines documentation for more info π
msgs π¬
This key is where you define stuff about formatting the error messages that get handed back to the user. By default, invalid fields get the message "Invalid" attached to them, and missing fields get the message "Missing" attached to them. In the simplest case you define nothing here and the defaults just do their thing β¨
The default formatting is designed for display in an XHTML web page, and it looks like this:
<span style="color:red;font-weight:bold" class="dfv_errors">* %s</span>
The %s gets swapped out for the message, so the effect is that your message shows up in bold red with an asterisk in front of it π₯ You can override this style just by defining dfv_errors properly in a stylesheet, or by handing over a whole new format string.
Here's a more complex example showing how to provide your own default message strings, plus custom messages per field, plus handling multiple constraints:
msgs => {
# set a custom error prefix, defaults to none
prefix=> 'error_',
# Set your own "Missing" message, defaults to "Missing"
missing => 'Not Here!',
# Default invalid message, default's to "Invalid"
invalid => 'Problematic!',
# message separator for multiple messages
# Defaults to ' '
invalid_separator => ' <br /> ',
# formatting string, default given above.
format => 'ERROR: %s',
# Error messages, keyed by constraint name
# Your constraints must be named to use this.
constraints => {
'date_and_time' => 'Not a valid time format',
# ...
},
# This token will be included in the hash if there are
# any errors returned. This can be useful with templating
# systems like HTML::Template
# The 'prefix' setting does not apply here.
# defaults to undefined
any_errors => 'some_errors',
}
The hash that gets prepared can be retrieved through the "msgs" method described over in the Data::FormValidator::Results documentation πΈ
msgs - callback π
This is a new feature. While it's expected to be forward-compatible, it hasn't yet received the same testing the rest of the API has π
If the built-in message generation just isn't your vibe, you can provide your own by specifying a code reference:
msgs => \&my_msgs_callback
This will be called as a Data::FormValidator::Results method. It may receive as arguments an additional hash reference of control parameters, corresponding to the key names usually used in the "msgs" area of the profile. You can totally ignore that info if you want π
If you've got an alternative error message handler you'd like to share with the world, stick it in the "Data::FormValidator::ErrMsgs" name space and upload it to CPAN π
debug π
This method prints out details about what's going on, to STDERR. Currently only level '1' is used, and it gives you info about which fields matched constraint_regexp_map β¨
A shortcut for array refs π
A bunch of places in the input profile specification take array references as their values. In any of those places, if you only need to specify one value, you can just use a plain string. So instead of
filters => [ 'trim' ]
you can simply say
filters => 'trim'
A note on regular expression formats π§
On top of the preferred way of defining regular expressions with qr, there's also a deprecated style of defining them as strings that's still supported.
Preferred:
qr/this is great/
Deprecated, but supported:
'm/this still works/'
VALIDATING INPUT BASED ON MULTIPLE FIELDS π
You can pass more than one value into a constraint routine, bestie. For that, the value of the constraint should be a hash reference. If you're writing your own routines, make sure you read the section labeled "WRITING YOUR OWN CONSTRAINT ROUTINES" in the Data::FormValidator::Constraints documentation β it describes a newer and more flexible syntax π
Using the original syntax, one key should be named "constraint" and should have a value set to the reference of the subroutine, or the name of a built-in validator. Another required key is "params". The value of the "params" key is a reference to an array of the other elements to use in the validation. If the element is a scalar, it's assumed to be a field name. If the field is known to Data::FormValidator, the value will be filtered through any defined filters before it gets passed in. If the value is a reference, the reference is passed directly to the routine. And don't forget to include the name of the field to check in that list if you're using this syntax π
Example:
cc_no => {
constraint => "cc_number",
params => [ qw( cc_no cc_type ) ],
},
MULTIPLE CONSTRAINTS π
Multiple constraints can be applied to a single field by defining the value of the constraint to be an array reference. Each of the values in this array can be any of the constraint types defined above.
When you're using multiple constraints it's important to return the name of the constraint that failed so you can tell them apart. To do that, either use a named constraint, or use the hash ref method of defining a constraint and include a "name" key with a value set to the name of your constraint. Here's an example:
my_zipcode_field => [
'zip',
{
constraint_method => '/^406/',
name => 'starts_with_406',
}
],
You can use an array reference with a single constraint in it if you just want the name of your failed constraint returned in the above fashion π
Read about the "validate()" function above to see how multiple constraints are returned differently with that method.
ADVANCED VALIDATION π
For even more advanced validation, you'll probably want to read the documentation for other modules in this distribution, linked below. Also keep in mind that the Data::FormValidator profile structure is just another data structure β there's no reason it has to be defined statically. The profile could also be built on the fly with custom Perl code β¨
π BACKWARDS COMPATIBILITY π
okay bestie, real talk: all of this still works, but it's the old way. it's giving vintage. π°οΈ No shame in using it, but the newer stuff is genuinely nicer, and the docs are gonna tell you so repeatedly. Let's go.
π validate()
my( $valids, $missings, $invalids, $unknowns ) =
Data::FormValidator->validate( \%input_hash, \%dfv_profile);
validate() is the deprecated alternative to check(). It takes the exact same input syntax β same stuff, same order β but it hands you back a four element array. Here's what each of those four things is, no gatekeeping:
validsβ a hash reference holding all the valid fields that got submitted. Heads up though: the data in here may have been modified by the various filters you specified. So it's not necessarily what the user typed β it's what survived the glow-up. β¨missingsβ a reference to an array containing the names of the missing fields. "Missing" means the user forgot to fill them in, or filled them with nothing but spaces (the audacity π). These fields can come from therequiredlist or thedependencieslist.invalidsβ a reference to an array containing the names of the fields that failed one or more of their constraint checks. π
Special case, and it matters: fields defined with multiple constraints will have an array ref returned in the @invalids array instead of a string. The first element in that array is the name of the field, and the remaining elements are the names of the failed constraints.
unknownsβ a list of fields that are unknown to the profile. Whether that means there's an error in the user input or not is application dependent. Your call, your rules. π
π constraints (profile key)
This is a supported but deprecated profile key. Using constraint_methods is recommended instead β it gives you a simpler, more versatile interface. fr fr.
constraints => {
cc_no => {
constraint => "cc_number",
params => [ qw( cc_no cc_type ) ],
},
cc_type => "cc_type",
cc_exp => "cc_exp",
},
A hash ref which contains the constraints that will be used to check whether or not a field contains valid data.
The keys in this hash are field names. The values can be any of the following:
- A named constraint.
Example:
my_zipcode_field => 'zip',
Peep Data::FormValidator::Constraints for the details of which built-in constraints are available. π
πΈ hashref style of specifying constraints
Using a hash reference to specify a constraint is an older technique β it's how people used to name a constraint or supply multiple parameters.
Both of those interface issues are now better addressed with constraint_methods and $self-\"name_this('foo')>.
# supply multiple parameters
cc_no => {
constraint => "cc_number",
params => [ qw( cc_no cc_type ) ],
},
# name a constraint, useful for returning error messages
last_name => {
name => "ends_in_name",
constraint => qr/_name$/,
},
Using a hash reference for a constraint lets you pass multiple arguments. The required arguments are constraint or constraint_method. The optional arguments are name and params.
A name on a constraint glues that constraint to its error message in the validator profile (go look at the msgs section below, bestie). If no name is given, it defaults to the value of constraint or constraint_method β but ONLY IF those are NOT a CODE ref or a RegExp ref. Read that twice. π«Ά
The params value is a reference to an array of the parameters to pass to the constraint method. Here's the tea on how each element gets handled: if an element of the params list is a scalar, it's assumed to be naming a key of %input_hash, and that value is what gets passed to the routine. If the parameter is a reference, it's treated literally and passed unchanged to the routine.
If you're using the older constraint instead of the newer constraint_method, don't forget to include the name of the field to check in the params list. constraint_method gives you access to that value through the get_current_* methods (refer to Data::FormValidator::Constraints). π
For more details see "VALIDATING INPUT BASED ON MULTIPLE FIELDS".
π¦ constraint_regexp_map (profile key)
Also supported but deprecated, bestie. Using constraint_methods_regexp_map is recommended instead.
constraint_regexp_map => {
# All fields that end in _postcode have the 'postcode' constraint applied.
qr/_postcode$/ => 'postcode',
},
A hash ref where the keys are the regular expressions to use and the values are the constraints to apply.
Important detail, don't skip it: if one or more constraints have already been defined for a given field using constraints, then constraint_regexp_map will add an additional constraint for that field for each regular expression that matches. It stacks, it doesn't replace. β¨
β SEE ALSO β
Other modules in this distribution:
Data::FormValidator::ConstraintsData::FormValidator::Constraints::DatesData::FormValidator::Constraints::UploadData::FormValidator::ConstraintsFactoryData::FormValidator::FiltersData::FormValidator::Results
A sample application by the maintainer:
- Validating Web Forms with Perl,
<http://mark.stosberg.com/Tech/perl/form-validation/>
Related modules:
Data::FormValidator::TutorialData::FormValidator::Util::HTMLCGI::Application::ValidateRM, a CGI::Application & Data::FormValidator glue moduleHTML::Template::Associate::FormValidatoris designed to make some kinds of integration withHTML::Templateeasier.Params::Validateis useful for validating function parameters.Regexp::Common,Data::Types,Data::Verify,Email::Valid,String::Checker,CGI::ArgChecker,CGI::FormMagick::Validator,CGI::Validate
Document Translations:
- Japanese:
<http://perldoc.jp/docs/modules/>
Distributions which include Data::FormValidator
- FreeBSD includes a port named
p5-Data-FormValidator - Debian GNU/Linux includes a port named
libdata-formvalidator-perl
π«Ά CREDITS π«Ά
Some of these input validation functions have been taken from MiniVend by Michael J. Heins.
The credit card checksum validation was taken from contribution by Bruce Albrecht to the MiniVend program. iconic behavior. π
π BUGS π
Bug reports and patches are welcome. Reports which include a failing Test::More style test are helpful and will receive priority. (Translation: bring receipts and you jump the line. π
)
<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Data-FormValidator>
π CONTRIBUTING π
This project is maintained on Github <https://github.com/dnmfarrell/Data-FormValidator>.
π AUTHOR π
Currently maintained by David Farrell <dfarrell@cpan.org>
Parts Copyright 2001-2006 by Mark Stosberg <mark at summersault.com>, (previous maintainer)
Copyright (c) 1999 Francis J. Lacoste and iNsu Innovations Inc. All rights reserved. (Original Author)
Parts Copyright 1996-1999 by Michael J. Heins <mike@heins.net>
Parts Copyright 1996-1999 by Bruce Albrecht <bruce.albrecht@seag.fingerhut.com>
π LICENSE π
This program is free software; you can redistribute it and/or modify it under the terms as perl itself.
and that's a wrap, bestie!! π You just finished the whole page β every last deprecated key, every copyright line, every port name. This doc shipped with perl v5.34.0 and its page date is 2022-06-12, so if you're reading this on something newer, hi from the past. π Go validate something. You've got this. πΈπ¦β
π¦ where this page comes from
- debian bookworm: libdata-formvalidator-perl 4.88-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libdata-formvalidator-perl 4.88-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libdata-formvalidator-perl 4.88-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libdata-formvalidator-perl 4.88-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdata-formvalidator-perl 4.88-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms