[Moose-commits] r7457 -
MooseX-Params-Validate/trunk/lib/MooseX/Params
autarch at code2.0beta.co.uk
autarch at code2.0beta.co.uk
Sat Jan 31 22:28:43 GMT 2009
Author: autarch
Date: 2009-01-31 14:28:43 -0800 (Sat, 31 Jan 2009)
New Revision: 7457
Modified:
MooseX-Params-Validate/trunk/lib/MooseX/Params/Validate.pm
Log:
Remvoe the class method stuff (it just adds complexity for no value)
Modified: MooseX-Params-Validate/trunk/lib/MooseX/Params/Validate.pm
===================================================================
--- MooseX-Params-Validate/trunk/lib/MooseX/Params/Validate.pm 2009-01-31 22:27:28 UTC (rev 7456)
+++ MooseX-Params-Validate/trunk/lib/MooseX/Params/Validate.pm 2009-01-31 22:28:43 UTC (rev 7457)
@@ -17,8 +17,6 @@
Moose::Exporter->setup_import_methods( as_is => [qw( validate validatep )] );
-my $class = __PACKAGE__;
-
sub validate {
my ( $args, %params ) = @_;
@@ -44,7 +42,7 @@
delete $params{MX_PARAMS_VALIDATE_NO_CACHE};
# prepare the parameters ...
- $params{$_} = $class->_convert_to_param_validate_spec( $params{$_} )
+ $params{$_} = _convert_to_param_validate_spec( $params{$_} )
foreach keys %params;
$CACHED_PARAM_SPECS{$cache_key} = \%params
if $should_cache;
@@ -55,7 +53,7 @@
my %args = @$args;
- $class->_coerce_args( \%args, \%params )
+ _coerce_args( \%args, \%params )
if grep { $params{$_}{coerce} } keys %params;
%args = Params::Validate::validate_with(
@@ -97,7 +95,7 @@
@ordered_params = grep { exists $params{$_} } @params;
# prepare the parameters ...
- $params{$_} = $class->_convert_to_param_validate_spec( $params{$_} )
+ $params{$_} = _convert_to_param_validate_spec( $params{$_} )
foreach keys %params;
$CACHED_PARAM_SPECS{$cache_key} = [ \%params, \@ordered_params ]
@@ -109,7 +107,7 @@
my %args = @$args;
- $class->_coerce_args( \%args, \%params )
+ _coerce_args( \%args, \%params )
if grep { $params{$_}{coerce} } keys %params;
%args = Params::Validate::validate_with(
@@ -124,7 +122,7 @@
}
sub _convert_to_param_validate_spec {
- my ( $self, $spec ) = @_;
+ my ($spec) = @_;
my %pv_spec;
$pv_spec{optional} = $spec->{optional}
@@ -193,7 +191,7 @@
}
sub _coerce_args {
- my ( $class, $args, $params ) = @_;
+ my ( $args, $params ) = @_;
for my $k ( grep { $params->{$_}{coerce} } keys %{$params} ) {
$args->{$k} = $params->{$k}{constraint}->coerce( $args->{$k} );
More information about the Moose-commits
mailing list