From: John Napiorkowski Date: Tue, 17 Mar 2015 20:14:19 +0000 (-0500) Subject: comment out coerce stuff for now X-Git-Tag: 5.90089_002~40 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=a7ab9aa9757994967ef1f2ec2252cf943a4252d7 comment out coerce stuff for now --- diff --git a/lib/Catalyst/Action.pm b/lib/Catalyst/Action.pm index 913e0de..37582e5 100644 --- a/lib/Catalyst/Action.pm +++ b/lib/Catalyst/Action.pm @@ -59,7 +59,7 @@ has number_of_args => ( scalar(@{$self->attributes->{Args}}) == 1 && looks_like_number($self->attributes->{Args}[0]) ) { - # 'Old school' numberd args (is allowed to be undef as well) + # 'Old school' numbered args (is allowed to be undef as well) return $self->attributes->{Args}[0]; } else { # New hotness named arg constraints @@ -151,14 +151,18 @@ sub match { # 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('ClassName')) + ( + $self->args_constraints->[0]->is_a_type_of('Ref') || + $self->args_constraints->[0]->is_a_type_of('ClassName') + ) ) { 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; - } + # Removing coercion stuff for the first go + #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; diff --git a/t/arg_constraints.t b/t/arg_constraints.t index fae6bc6..57a90fe 100644 --- a/t/arg_constraints.t +++ b/t/arg_constraints.t @@ -28,6 +28,7 @@ BEGIN { as Int, where { $_ < 5 }; + # Tests using this are skipped pending deeper thought coerce User, from ContextLike, via { $_->model('User')->find( $_->req->args->[0] ) }; @@ -67,6 +68,7 @@ BEGIN { $c->res->body("name: $user->{name}, age: $user->{age}"); } + # Tests using this are current skipped pending coercion rethink sub user_object :Local Args(User) Coerce(1) { my ($self, $c, $user) = @_; $c->res->body("name: $user->{name}, age: $user->{age}"); @@ -180,12 +182,15 @@ use Catalyst::Test 'MyApp'; is $res->content, 'default'; } -{ + +SKIP: { + skip "coercion support needs more thought", 1; my $res = request '/user_object/20'; is $res->content, 'default'; } -{ +SKIP: { + skip "coercion support needs more thought", 1; my $res = request '/user_object/2'; is $res->content, 'name: mary, age: 36'; } diff --git a/t/undef-params.t b/t/undef-params.t index adb0934..24b23cc 100644 --- a/t/undef-params.t +++ b/t/undef-params.t @@ -33,7 +33,7 @@ use Plack::Test; $SIG{__WARN__} = sub { my $error = shift; - Test::More::like($error, qr[You called ->params with an undefined value at t.undef-params.t]) + Test::More::like($error, qr[You called ->params with an undefined value]) unless MyApp->debug; };