Input::Validator::Constraint::Callback - Callback constraint
$validator->field('foo')->callback(sub { my $value = shift; return 1 if $value =~ m/^\d+$/; return (0, 'Value is not a number'); });
Run a callback to validate a field. Return a true value when validation succeded, and false value when failed.
In order to set your own error instead of a default one return an array where the error message is the second argument.
is_valid
Validates the constraint.
Input::Validator, Input::Validator::Constraint
To install Input::Validator, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Input::Validator
CPAN shell
perl -MCPAN -e shell install Input::Validator
For more information on module installation, please visit the detailed CPAN module installation guide.