comment out coerce stuff for now
John Napiorkowski [Tue, 17 Mar 2015 20:14:19 +0000 (15:14 -0500)]
lib/Catalyst/Action.pm
t/arg_constraints.t
t/undef-params.t

index 913e0de..37582e5 100644 (file)
@@ -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;
index fae6bc6..57a90fe 100644 (file)
@@ -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';
 }
index adb0934..24b23cc 100644 (file)
@@ -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;
   };