Fix small typo
[gitmo/MooseX-Params-Validate.git] / lib / MooseX / Params / Validate.pm
index 5153916..6997aca 100644 (file)
@@ -7,8 +7,10 @@ use Carp 'confess';
 use Devel::Caller 'caller_cv';
 use Scalar::Util 'blessed', 'refaddr', 'reftype';
 
-use Moose::Util::TypeConstraints qw( find_type_constraint class_type role_type );
-use Params::Validate             ();
+use Moose 0.58 ();
+use Moose::Util::TypeConstraints
+    qw( find_type_constraint class_type role_type );
+use Params::Validate 0.88 ();
 use Sub::Exporter -setup => {
     exports => [
         qw( validated_hash validated_list pos_validated_list validate validatep )
@@ -48,7 +50,7 @@ sub validated_hash {
     my $instance;
     $instance = shift @$args if blessed $args->[0];
 
-    my %args 
+    my %args
         = @$args == 1
         && ref $args->[0]
         && reftype( $args->[0] ) eq 'HASH' ? %{ $args->[0] } : @$args;
@@ -101,7 +103,7 @@ sub validated_list {
     my $instance;
     $instance = shift @$args if blessed $args->[0];
 
-    my %args 
+    my %args
         = @$args == 1
         && ref $args->[0]
         && reftype( $args->[0] ) eq 'HASH' ? %{ $args->[0] } : @$args;
@@ -154,10 +156,7 @@ sub pos_validated_list {
             if $should_cache;
     }
 
-    my @args 
-        = @$args == 1
-        && ref $args->[0]
-        && reftype( $args->[0] ) eq 'ARRAY' ? @{ $args->[0] } : @$args;
+    my @args = @$args;
 
     $args[$_] = $pv_spec[$_]{constraint}->coerce( $args[$_] )
         for grep { $pv_spec[$_] && $pv_spec[$_]{coerce} } 0 .. $#args;
@@ -303,6 +302,9 @@ is where if it spots an instance in the C<@_>, then it will handle
 it appropriately (unlike Params::Validate which forces you to shift
 you C<$self> first).
 
+The values in C<@_> can either be a set of name-value pairs or a single hash
+reference.
+
 The C<%parameter_spec> accepts the following options:
 
 =over 4
@@ -356,6 +358,9 @@ We capture the order in which you defined the parameters and then
 return them as a list in the same order. If a param is marked optional
 and not included, then it will be set to C<undef>.
 
+The values in C<@_> can either be a set of name-value pairs or a single hash
+reference.
+
 Like C<validated_hash>, if it spots an object instance as the first
 parameter of C<@_>, it will handle it appropriately, returning it as
 the first argument.
@@ -382,6 +387,10 @@ Unlike the other functions, this function I<cannot> find C<$self> in
 the argument list. Make sure to shift it off yourself before doing
 validation.
 
+The values in C<@_> must be a list of values. You cannot pass the values as an
+array reference, because this cannot be distinguished from passing one value
+which is itself an array reference.
+
 If a parameter is marked as optional and is not present, it will
 simply not be returned.
 
@@ -405,9 +414,9 @@ below, simply pass them after the list of parameter validation specs:
 =head1 ALLOWING EXTRA PARAMETERS
 
 By default, any parameters not mentioned in the parameter spec cause this
-module to throw an error. However, you can have have this module simply ignore
-them by setting C<MX_PARAMS_VALIDATE_ALLOW_EXTRA> to a true value when calling
-a validation subroutine.
+module to throw an error. However, you can have this module simply ignore them
+by setting C<MX_PARAMS_VALIDATE_ALLOW_EXTRA> to a true value when calling a
+validation subroutine.
 
 When calling C<validated_hash> or C<pos_validated_list> the extra parameters
 are simply returned in the hash or list as appropriate. However, when you call