The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Validator::Custom::Result - Result of validation

SYNOPSYS

    # Result
    my $result = $vc->validate($data, $rule);
    
    # Check the existence of missing parameter
    my $has_missing_param = $result->has_missing;

    # Chack if the data has invalid parameter(except for missing parameter)
    my $has_invalid = $resutl->has_invalid;
    
    # Chacke if the result is valid.
    # (this means result have neither missing nor invalid parameter)
    my $is_ok = $result->is_ok;
    
    # Check if one parameter is valid
    my $title_is_valid = $result->is_valid('title');

    # Missing parameters(this is original keys)
    my $missing_params = $result->missing_params;
    
    # Invalid parameter names(this is original keys)
    my $invalid_params = $result->invalid_params;
    
    # Invalid rule keys
    my $invalid_rule_keys = $result->invalid_rule_keys;

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

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

    # Error messages to hash ref
    my $messages_hash = $result->message_to_hash;
    
    # Raw data
    my $raw_data = $result->raw_data;
    
    # Result data
    my $result_data = $result->data;

ATTRIBUTES

data

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

Result data.

missing_params

    my $missing_params = $result->missing_params;
    $result            = $result->missing_params($missing_params);

Missing parameters

raw_data

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

Raw data soon after data_filter is excuted.

(depricated) error_infos

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

Error informations.

METHODS

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

error_reason

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

Error reason. This is constraint name.

has_invalid

    my $has_invalid = $result->has_invalid;

Check if the data has invalid parameter

has_missing

    my $has_missing_param = $result->has_missing;

Check the existence of missing parameter.

is_ok

    $is_ok = $result->is_ok;

Check if the result is ok. this means that data has no missing parameter and no invalid parameter.

is_valid

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

Check if one paramter is valid.

message

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

Error message.

messages

    $messages = $result->messages;

Error messages.

messages_to_hash

    $messages = $result->messages_to_hash;

Error messages to hash reference.

invalid_params

    $invalid_params = $result->invalid_params;

Invalid raw data parameter names.

invalid_rule_keys

    $invalid_rule_keys = $result->invalid_rule_keys;

Invalid rule keys

(depricated) add_error_info

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

Add error informations.

(deprecated) errors

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

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

Error messages.

(deprecated) error

error() is deprecated. Use message() instead.

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

A error message

(deprecated) errors_to_hash

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

    $errors = $result->errors_to_hash;

Error messages to hash reference.

(deprecated) invalid_keys

invalid_keys() is deprecated. Use invalid_rule_keys() instead.

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

Invalid rule keys.

(depricated) remove_error_info

    $result->remove_error_info($name);

Remove error information.