From: John Napiorkowski Date: Sun, 29 Mar 2009 17:35:20 +0000 (+0000) Subject: switch to ->check([arrayref]), its more to type but allows up to set a sane parent... X-Git-Tag: 0.01~47 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3313d2a6ae4206e091e7ec88fc4a2f672b6b1654;p=gitmo%2FMooseX-Dependent.git switch to ->check([arrayref]), its more to type but allows up to set a sane parent type --- 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,