The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Input::Validator::Constraint::Callback - Callback constraint

SYNOPSIS

    $validator->field('foo')->callback(sub {
        my $value = shift;

        return 1 if $value =~ m/^\d+$/;

        return (0, 'Value is not a number');
    });

DESCRIPTION

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.

METHODS

is_valid

Validates the constraint.

SEE ALSO

Input::Validator, Input::Validator::Constraint