NAME

Validator::Custom::Result - Validator::Custom result

SYNOPSYS

# Error messages
@errors = $result->errors;

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

# Error messages as hash ref
$errors = $result->errors_to_hash;

# Invalid keys
@invalid_keys = $result->invalid_keys;

# Producted values
$products = $result->products;
$product  = $products->{key1};

# Is the result valid?
$is_valid = $result->is_valid;

# Is one data valid?
$is_valid = $result->is_valid('title');

ATTRIBUTES

error_infos

Error infos

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

products

Producted values

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

METHODS

add_error_info

Add error informations

$result->add_error_info($error_info);

Example

$result->add_error_info({invalid_key => $product_key,
                         message     => $message});

is_valid

Check if result is valid.

$is_valid = $result->is_valid;

Check if the data corresponding to the key is valid.

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

error

Get one error message.

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

errors

Get error messages

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

error_reason

Get error reason. this is same as constraint name.

$error_reason = $result->error_reason($key);

errors_to_hash

Get error messages as hash ref

$errors = $result->errors_to_hash;

invalid_keys

Get invalid keys

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

remove_error_info

Remove error information

$result->remove_error_info($key);