NAME

Input::Validator::Condition - Condition object

SYNOPSIS

$validator->when('document')->regexp(qr/^1$/)
  ->then(sub { shift->field('number')->required(1) });

DESCRIPTION

Condition object.

ATTRIBUTES

then

$condition->then(sub { ... });

Holds callback that is called when conditions is matched.

METHODS

constraint

$condition->consraint(length => [1, 3]);

Adds a constraint.

length

Shortcut

$condition->consraint(length => @_);

match

my $matched = $condition->match;

Check whether conditions is matched.

regexp

Shortcut

$condition->consraint(regexp => @_);

when

$condition->when('foo');
$condition->when(qw/foo bar/);
$condition->when([qw/foo bar baz/]);

Adds fields which values are checked to match the condition.

SEE ALSO

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