Skip Menu |

This queue is for tickets about the MooseX-Params-Validate CPAN distribution.

Report information
The Basics
Id: 47647
Status: resolved
Priority: 0/
Queue: MooseX-Params-Validate

People
Owner: Nobody in particular
Requestors: kane [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: (no value)
Fixed in: 0.11



Subject: MX::P::V silently throws away callbacks option
Greetings, MX::PV doesn't pass the callbacks option along to PV. Instead, it's dropped silently. The attached patch fixes this. Cheers,
Subject: pv.patch
=================================================================== --- /home/demo/perl/5.10/lib/site_perl/5.10.0/MooseX/Params/Validate.pm (revision 1788) +++ /home/demo/perl/5.10/lib/site_perl/5.10.0/MooseX/Params/Validate.pm (working copy) @@ -200,6 +200,9 @@ $pv_spec{coerce} = $spec->{coerce} if exists $spec->{coerce}; + $pv_spec{callbacks} = $spec->{callbacks} + if exists $spec->{callbacks}; + if ( exists $spec->{isa} ) { my $constraint; @@ -216,10 +219,9 @@ $pv_spec{constraint} = $constraint; - $pv_spec{callbacks} = { - 'checking type constraint for ' - . $constraint->name => sub { $constraint->check( $_[0] ) } - }; + $pv_spec{callbacks}->{ + 'checking type constraint for '. $constraint->name + } = sub { $constraint->check( $_[0] ) }; } elsif ( exists $spec->{does} ) { @@ -236,10 +238,9 @@ $pv_spec{constraint} = $constraint; - $pv_spec{callbacks} = { - 'checking type constraint for ' - . $constraint->name => sub { $constraint->check( $_[0] ) } - }; + $pv_spec{callbacks}->{ + 'checking type constraint for '. $constraint->name + } = sub { $constraint->check( $_[0] ) }; } delete $pv_spec{coerce}