X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FMeta%2FTypeConstraint%2FDependent.pm;h=9e02be5753344b805170468689950f65fc72fbe9;hb=3313d2a6ae4206e091e7ec88fc4a2f672b6b1654;hp=50e2a9c90b9251e429e0a1357b291f980ff0ac3f;hpb=9274c53e6cbcb7cac4a8ebd1ee7841a93c33fbe8;p=gitmo%2FMooseX-Dependent.git diff --git a/lib/MooseX/Meta/TypeConstraint/Dependent.pm b/lib/MooseX/Meta/TypeConstraint/Dependent.pm index 50e2a9c..9e02be5 100644 --- a/lib/MooseX/Meta/TypeConstraint/Dependent.pm +++ b/lib/MooseX/Meta/TypeConstraint/Dependent.pm @@ -114,17 +114,8 @@ Make sure when properly dispatch all the right values to the right spots =cut around 'check' => sub { - my ($check, $self, $check_value, $constraining_value) = @_; - - unless($self->check_dependent($check_value)) { - return; - } - - unless($self->check_constraining($constraining_value)) { - return; - } - - return $self->$check($check_value, $constraining_value); + my ($check, $self, @args) = @_; + return $self->$check(@args); }; =head2 generate_constraint_for ($type_constraints) @@ -137,7 +128,18 @@ of values (to be passed at check time) sub generate_constraint_for { my ($self, $callback, $constraining) = @_; return sub { - my ($check_value, $constraining_value) = @_; + my ($dependent_pair) = @_; + my ($check_value, $constraining_value) = @$dependent_pair; + + ## First need to test the bits + unless($self->check_dependent($check_value)) { + return; + } + + unless($self->check_constraining($constraining_value)) { + return; + } + my $constraint_generator = $self->constraint_generator; return $constraint_generator->( $callback,