|
NAMEValidator::Custom::Validation - a result of validation SYNOPSYS 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;
METHODSValidator::Custom::Validation inherits all methods from Object::Simple and implements the following new ones. newmy $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; is_valid 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. add_failed $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. failedmy $failed = $validation->failed; Get all failed parameter names. message my $message = $validation->message('title');
Get a failed message corresponding to the name. messagesmy $messgaes = $validation->messages; Get all failed messages. messages_to_hashmy $messages_h = $validation->messages_to_hash; Get all failed parameter names and messages as hash reference.
|