++ed by:
Cory G Watson

NAME

Data::Verifier::Field - Field from a Data::Verifier profile

VERSION

version 0.56

SYNOPSIS

    use Data::Verifier;

    my $dv = Data::Verifier->new(profile => {
        name => {
            required    => 1,
            type        => 'Str',
            filters     => [ qw(collapse trim) ]
        },
        age  => {
            type        => 'Int'
        },
        sign => {
            required    => 1,
            type        => 'Str'
        }
    });

    my $results = $dv->verify({
        name => 'Cory', age => 'foobar'
    });


    my $field = $results->get_field('name');
    print $field->value;

DESCRIPTION

Data::Verifier::Field provides all post-verification information on a given field.

ATTRIBUTES

original_value

The string value of the field before any filters or coercion. This will survive serialization whereas value will not.

post_filter_value

The string value of the field before after filters but before coercion. This will survive serialization whereas value will not.

reason

If this field is invalid then this attribute should contain a "reason". Out of the box it will always contain a string. One of:

dependent

A dependent check failed.

has_coerced_value

Predicate for the coerced_value attribute.

max_length

The value was larger than the field's max length.

min_length

The value was shorter than the field's min length.

post_check

The post check failed.

type_constraint

The value did not pass the type constraint.

derived

The value failed because a value derived from it failed.

valid

Boolean value representing this fields validity.

value

The value of this field. This will not be present if serialized, as it could be any value, some of which we may not know how to Serialize. See original_value.

METHODS

has_original_value

Predicate that returns true if this field has an original value.

has_post_filter_value

Predicate that returns true if this field has a post filter value.

has_reason

Predicate that returns true if this field has a reason.

clear_value

Clears the value attribute.

AUTHOR

Cory G Watson <gphat@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Cold Hard Code, LLC.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.




Hosting generously
sponsored by Bytemark