Validator::Custom::Validation - a result of validation
my $validation = $vc->validation;
$validation->add_failed(title => 'title is invalid');
$validation->add_failed(name => 'name is invalid');
# Is valid
my $is_valid = $validation->is_valid;
my $title_is_valid = $validation->is_valid('title');
# Get all failed parameter names
my $failed = $validation->failed;
# Message
my $messages = $validation->messages;
my $title_message = $validation->message('title');
my $messages_h = $validation->messages_to_hash;
Validator::Custom::Validation inherits all methods from Object::Simple and
implements the following new ones.
my $validation = Validator::Custom::Validation->new;
Create a Validator::Custom::Validation object.
Generally this method is not used. You should use "validation" method
of Validator::Custom.
my $validation = $vc->validation;
my $is_valid = $validation->is_valid;
my $is_valid = $validation->is_valid('title');
Check if the result of validation is valid. If name is specified, check if the
parameter corresponding to the name is valid.
$validation->add_failed('title' => 'title is invalid value');
$validation->add_failed('title');
Add a failed parameter name and message. If message is omitted, default message
is set automatically.
my $failed = $validation->failed;
Get all failed parameter names.
my $message = $validation->message('title');
Get a failed message corresponding to the name.
my $messgaes = $validation->messages;
Get all failed messages.
my $messages_h = $validation->messages_to_hash;
Get all failed parameter names and messages as hash reference.