Skip to content
Browse files

Adding in support for a HashRef[Str] on original_value, as it still s…

…erializes well and nested params are good.
  • Loading branch information...
1 parent 46cf46b commit be79bc127356b87f235dff7439b276dc3f346f8d @jshirley jshirley committed May 7, 2011
Showing with 6 additions and 4 deletions.
  1. +4 −2 lib/Data/Verifier.pm
  2. +2 −2 lib/Data/Verifier/Field.pm
View
6 lib/Data/Verifier.pm
@@ -481,7 +481,7 @@ sub verify {
$val = undef;
}
- if(ref($val)) {
+ if(ref($val) eq 'ARRAY' ) {
my @values = @{ $val };
$field->post_filter_value(\@values);
} else {
@@ -612,7 +612,9 @@ sub _filter_value {
if(ref($filters) ne 'ARRAY') {
$filters = [ $filters ];
}
- if(!ref($values)) {
+ # If we already have an array, just let it be. Otherwise transform the
+ # value into an array. ($values may also be a HashRef[Str] here)
+ unless ( ref $values eq 'ARRAY' ) {
$created_ref = 1;
$values = [ $values ];
}
View
4 lib/Data/Verifier/Field.pm
@@ -36,7 +36,7 @@ Predicate that returns true if this field has a post filter value.
has post_filter_value => (
is => 'rw',
- isa => 'Maybe[Str|ArrayRef]',
+ isa => 'Maybe[Str|ArrayRef|HashRef[Str]]',
predicate => 'has_post_filter_value'
);
@@ -153,4 +153,4 @@ __END__
Data::Verifier::Field provides all post-verification information on a given
field.
-=cut
+=cut

0 comments on commit be79bc1

Please sign in to comment.
Something went wrong with that request. Please try again.