X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FAction.pm;h=6081f227708ace80cc458ceec1c1f5a01e43b2e4;hp=274ffd9937bb84fc0d1c91ea0ea6df1a5a0ea10e;hb=6f0b85d2a35e5b4872bf508d859fae3621d81406;hpb=842180f78ebf88d45517df4222c68057f2bea1ef diff --git a/lib/Catalyst/Action.pm b/lib/Catalyst/Action.pm index 274ffd9..6081f22 100644 --- a/lib/Catalyst/Action.pm +++ b/lib/Catalyst/Action.pm @@ -147,14 +147,19 @@ sub match { # There there are arg constraints, we must see to it that the constraints # check positive for each arg in the list. - if($self->has_args_constraints) { + if(0 && $self->has_args_constraints) { # If there is only one type constraint, and its a Ref or subtype of Ref, # That means we expect a reference, so use the full args arrayref. if( $self->number_of_args_constraints == 1 && - $self->args_constraints->[0]->is_a_type_of('Ref') + ($self->args_constraints->[0]->is_a_type_of('Ref') || $self->args_constraints->[0]->is_a_type_of('ClassName')) ) { - return $self->args_constraints->[0]->check($c->req->args); + return 1 if $self->args_constraints->[0]->check($c->req->args); + if($self->args_constraints->[0]->coercion && $self->attributes->{Coerce}) { + my $coerced = $self->args_constraints->[0]->coerce($c) || return 0; + $c->req->args([$coerced]); + return 1; + } } else { for my $i(0..$#{ $c->req->args }) { $self->args_constraints->[$i]->check($c->req->args->[$i]) || return 0; @@ -239,6 +244,9 @@ of the captures for this action. Returning true from this method causes the chain match to continue, returning makes the chain not match (and alternate, less preferred chains will be attempted). +=head2 resolve_type_constraint + +Trys to find a type constraint if you have on on a type constrained method. =head2 compare