edce11a16e4f8923043d59989d25df6f780dc899
[catagits/CatalystX-Declare.git] / t / lib / TestApp / ControllerRole / Parameterized.pm
1 use CatalystX::Declare;
2
3 controller_role TestApp::ControllerRole::Parameterized (Str :$message, Str :$base, Str :$part, Str :$action) {
4
5     method get_message { $message }
6
7     final action greet under base {
8         $ctx->response->body( join ':', $self->get_message, $message );
9     }
10
11     final action dynabase under "$base" {
12         $ctx->response->body( "under $base" );
13     }
14
15     final action dynapart under "$base" as $part {
16         $ctx->response->body( "under $base as $part" );
17     }
18
19     under $base {
20
21         final action scoped {
22             $ctx->response->body( "scoped under $base" );
23         }
24
25         final action complex as "$part/deep" {
26             $ctx->response->body( "$part/deep under $base" );
27         }
28
29         final action $action {
30             $ctx->response->body( "$action action" );
31         }
32
33         final action actionalias {
34             $self->$action($ctx);
35         }
36     }
37
38     my $upper_part = uc $part;
39
40     final action upper as $upper_part under $base {
41         $ctx->response->body("upper as $upper_part under $base");
42     }
43 }