Form::Sensible::Validator - Default Validator for Form::Sensible forms
use Form::Sensible::Validator; my $object = Form::Sensible::Validator->new(); $validator_result = $object->validate($form);
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).
Performs validation of a Form. Returns a Form::Sensible::Validator::Result object with the results of form validation for the passed form.
Performs complete validation on the given field. Returns an array of hashes containing error messaging (or an empty array on success.) Each hash returned will contain a key of either
'missing' and a value containing the error message.
Internal routine to perform regex based validation of a field.
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:
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
The message_delegate is used to assemble error and other validation related messages. By default the message_delegate simply loads $message and replaces any occurance of
_FIELDNAME_ with the field's name. Should return the processed message. This is an ideal place to handle localization of messages or other customization. If no translation can be found, you are strongly encouraged to return the message as is (with
_FIELDNAME_ converted to the actual field name, of course.)
Jay Kuri - <email@example.com>
Ionzero LLC. http://ionzero.com/
Copyright 2009 by Jay Kuri <firstname.lastname@example.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.