Data::Verifier::Nested - Nested profile based data verification with Moose type constraints.
version 0.61
use Data::Verifier::Nested; my $dv = Data::Verifier::Nested->new( filters => [ qw(trim) ], profile => { name => { first_name => { type => 'Str', required => 1 }, last_name => { type => 'Str', required => 1 }, }, age => { type => 'Int' }, sign => { required => 1 }, } ); # Pass in a hash of data my $results = $dv->verify({ name => { first_name => 'Cory', last_name => 'Watson' }, age => 'foobar' }); $results->success; # no $results->is_invalid('name.first_name'); # no $results->is_invalid('name.last_name'); # no $results->is_invalid('age'); # yes $results->is_missing('name.first_name'); # no $results->is_invalid('name.last_name'); # no $results->is_missing('sign'); # yes $results->get_original_value('name.first_name'); # Unchanged, original value $results->get_value('name.first_name'); # Filtered, valid value $results->get_value('age'); # undefined, as it's invalid
Data::Verifier allows you verify data that is in a flat hash, but sometimes this is not enough, this is where Data::Verifier::Nested comes in. It is a subclass of Data::Verifier that can work with nested data structures.
Stevan Little
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.