Binary files Data-FormValidator-4.49_1.orig/Data-FormValidator-4.49_1.tar.gz and Data-FormValidator-4.49_1/Data-FormValidator-4.49_1.tar.gz differ
diff -r --new-file Data-FormValidator-4.49_1.orig/lib/Data/FormValidator/Constraints.pm Data-FormValidator-4.49_1/lib/Data/FormValidator/Constraints.pm
326c326
< my $data = $dfv->get_input_data;
---
> my $data = $dfv->get_filtered_data;
531c531
< my $data = $dfv->get_input_data;
---
> my $data = $dfv->get_filtered_data;
771c771
< my $data = $dfv->get_input_data;
---
> my $data = $dfv->get_filtered_data;
835a836,848
> =head3 get_filtered_data()
>
> Returns the filtered input data. This may be a CGI object if that's what
> was used in the constraint routine.
>
> B<Examples:>
>
> # Raw and uncensored
> my $data = $self->get_filtered_data;
>
> # tamed to be a hashref, if it wasn't already
> my $data = $self->get_filtered_data( as_hashref => 1 );
>
diff -r --new-file Data-FormValidator-4.49_1.orig/lib/Data/FormValidator/Results.pm Data-FormValidator-4.49_1/lib/Data/FormValidator/Results.pm
170a171,173
>
> # store the filtered data away for later use
> $self->{__FILTERED_DATA} = \%valid;
726a730,741
> sub get_filtered_data {
> my $self = shift;
> my %p = @_;
> if ($p{as_hashref}) {
> my %hash = $self->_get_input_as_hash( $self->{__FILTERED_DATA} );
> return \%hash;
> }
> else {
> return $self->{__FILTERED_DATA};
> }
> }
>
diff -r --new-file Data-FormValidator-4.49_1.orig/MANIFEST Data-FormValidator-4.49_1/MANIFEST
55a56
> t/get_filtered_data.t
diff -r --new-file Data-FormValidator-4.49_1.orig/t/get_filtered_data.t Data-FormValidator-4.49_1/t/get_filtered_data.t
0a1,48
> use strict;
> use Test::More tests => 4;
> use Data::FormValidator;
> use Data::FormValidator::Constraints qw(FV_eq_with);
>
> # Empty data/empty results; make sure fcn call works fine
> access_filtered_data_no_data: {
> my $results = Data::FormValidator->check( {}, {} );
> my $filtered = $results->get_filtered_data();
> is_deeply( $filtered, {}, 'get_filtered_data works for empty hashref' );
> }
>
> # Test to make sure that we can access filtered data and that it looks right.
> access_filtered_data: {
> my $data = {
> 'password' => ' foo ',
> 'confirm' => ' foo ',
> };
> my $expect_filtered_data = {
> 'password' => 'foo',
> 'confirm' => 'foo',
> };
> my $profile = {
> 'required' => [qw( password confirm )],
> 'filters' => 'trim',
> };
> my $results = Data::FormValidator->check( $data, $profile );
> my $filtered = $results->get_filtered_data();
> is_deeply( $filtered, $expect_filtered_data, 'get_filtered_data returns correct filtered data' );
> }
>
> # RT#22589; FV_eq_with uses 'get_filtered_data()'
> rt22589: {
> my $data = {
> 'password' => ' foo ',
> 'confirm' => ' foo ',
> };
> my $profile = {
> 'required' => [qw( password confirm )],
> 'filters' => 'trim',
> 'constraint_methods' => {
> 'confirm' => FV_eq_with('password'),
> },
> };
> my $results = Data::FormValidator->check( $data, $profile );
> ok( $results->valid('password'), 'password valid' );
> ok( $results->valid('confirm'), 'confirm valid' );
> }