NAME
Form::Sensible::Validator - Default Validator for Form::Sensible forms
SYNOPSIS
use Form::Sensible::Validator;
my $object = Form::Sensible::Validator->new();
$validator_result = $object->validate($form);
DESCRIPTION
Form::Sensible::Validator performs the grunt work of validating a form. It understands how to handle regex based field validation as well as coderef based field validation. It also is responsible for calling field-type specific validation. Usually this class is not manipulated directly. Instead, $form->validate()
is used, which in turn calls the validator already associated with the form (or creates one if none is already defined).
METHODS
validate($form)
-
Performs validation of a Form. Returns a Form::Sensible::Validator::Result object with the results of form validation for the passed form.
validate_field_with_regex($field, $regex)
-
Internal routine to perform regex based validation of a field.
validate_field_with_coderef($field, $coderef)
-
Internal routine to perform code based validation of a field. When called, the
$coderef
is called with the field's value as the first argument, and the field itself as the second:$coderef->($field_value, $field);
The subroutine is expected to return 0 on successful validation, or an appropriate error message on failed validation. This may seem somewhat confusing, returning 0 on a valid field. It may help to think of the coderef as being the equivalent of a
is_field_invalid()
routine.
AUTHOR
Jay Kuri - <jayk@cpan.org>
SPONSORED BY
Ionzero LLC. http://ionzero.com/
SEE ALSO
LICENSE
Copyright 2009 by Jay Kuri <jayk@cpan.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.