Data::Verifier::Field - Field from a Data::Verifier profile
version 0.59
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;
Data::Verifier::Field provides all post-verification information on a given field.
The string value of the field before any filters or coercion. This will survive serialization whereas value will not.
The string value of the field before after filters but before coercion. This will survive serialization whereas value will not.
If this field is invalid then this attribute should contain a "reason". Out of the box it will always contain a string. One of:
A dependent check failed.
Predicate for the coerced_value attribute.
coerced_value
The value was larger than the field's max length.
The value was shorter than the field's min length.
The post check failed.
The value did not pass the type constraint.
The value failed because a value derived from it failed.
Boolean value representing this fields validity.
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.
original_value
Predicate that returns true if this field has an original value.
Predicate that returns true if this field has a post filter value.
Predicate that returns true if this field has a reason.
Clears the value attribute.
Cory G Watson <gphat@cpan.org>
This software is copyright (c) 2016 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.
To install Data::Verifier, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Verifier
CPAN shell
perl -MCPAN -e shell install Data::Verifier
For more information on module installation, please visit the detailed CPAN module installation guide.