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

NAME

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

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');
    say $field->value;

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:

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.

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.

METHODS

clear_value

Clears the value attribute.

AUTHOR

Cory G Watson, <gphat at cpan.org>

COPYRIGHT & LICENSE

Copyright 2009 Cold Hard Code, LLC

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.