support multiply attributes of the same name using the expected Catalyst style (arrayref)
[catagits/CatalystX-Declare.git] / t / lib / TestApp / Controller / ActionParams.pm
index aff3e0c..4b524a7 100644 (file)
@@ -5,10 +5,10 @@ role hasActionParams {
     has [qw/p1 p2/] => (is=>'ro', lazy_build=>1);
 
     method _build_p1 {
-        $self->attributes->{p1}->[0];
+        join ',', @{$self->attributes->{p1}};
     }
     method _build_p2 {
-        $self->attributes->{p2}->[0];
+        join ',', @{$self->attributes->{p2}};
     }
 }
 
@@ -43,5 +43,15 @@ controller ::Controller::ActionParams {
         my $p2 = $ctx->controller->action_for('third')->p2;
         $ctx->response->body("action_args_third: $p1,$p2");
     }
+
+    action forth under base
+    with (hasActionParams(
+        p1=>400,
+        p2=>401,
+    ), hasActionParams(p1=>1,p2=>2)) is final {
+        my $p1 = $ctx->controller->action_for('forth')->p1;
+        my $p2 = $ctx->controller->action_for('forth')->p2;
+        $ctx->response->body("action_args_forth: $p1,$p2");
+    }
 }