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

NAME

Data::Verifier::Nested - Nested profile based data verification with Moose type constraints.

VERSION

version 0.54

SYNOPSIS

    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

DESCRIPTION

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.

CONTRIBUTORS

Stevan Little

AUTHOR

Cory G Watson <gphat@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 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.