NAME

Validator::Custom::Result - Result of validation

SYNOPSYS

# Result
my $result = $vc->validate($data, $rule);

# Chacke if the result is valid.
my $is_valid = $result->is_valid;

# Error messages
my $messages = $result->messages;

# Error messages to hash ref
my $messages_hash = $result->message_to_hash;

# A error message
my $message = $result->message('title');

# Invalid parameter names
my $invalid_params = $result->invalid_params;

# Invalid rule keys
my $invalid_rule_keys = $result->invalid_rule_keys;

# Raw data
my $raw_data = $result->raw_data;

# Result data
my $result_data = $result->data;

ATTRIBUTES

data

Result data.

$result = $result->data($data);
$data   = $result->data;

raw_data

Raw data soon after data_filter is excuted.

$result = $result->raw_data($data);
$data   = $result->raw_data;

error_infos

Error informations.

$result      = $result->error_infos($error_infos);
$error_infos = $result->error_infos;

METHODS

Validator::Custom::Result inherits all methods from Object::Simple and implements the following new ones.

is_valid

Check if the result is valid.

$is_valid = $result->is_valid;

messages

Error messages.

$messages = $result->messages;

message

Error message.

$message = $result->message('title');

messages_to_hash

Error messages to hash reference.

$messages = $result->messages_to_hash;

invalid_params

Invalid raw data parameter names.

$invalid_params = $result->invalid_params;

invalid_rule_keys

Invalid rule keys

$invalid_rule_keys = $result->invalid_rule_keys;

error_reason

Error reason. This is constraint name.

$error_reason = $result->error_reason('title');

add_error_info

Add error informations.

$result->add_error_info($name => $error_info);

remove_error_info

Remove error information.

$result->remove_error_info($name);

(deprecated) errors

errors() is deprecated. Please use message() instead.

Error messages.

$errors = $result->errors;
@errors = $result->errors;

(deprecated) errors_to_hash

errors_to_hash() is deprecated. Please use messages_to_hash() instead.

Error messages to hash reference.

$errors = $result->errors_to_hash;

(deprecated) error

error() is deprecated. Please use message() instead.

A error message

$error = $result->error('title');

(deprecated) invalid_keys

invalid_keys() is deprecated. Please use invalid_rule_keys() instead.

Invalid rule keys.

@invalid_keys = $result->invalid_keys;
$invalid_keys = $result->invalid_keys;