6 package MyApp::Controller::Root;
7 $INC{'MyApp/Controller/Root.pm'} = __FILE__;
10 use MooseX::MethodAttributes;
12 extends 'Catalyst::Controller';
14 sub chain_base :Chained(/) CaptureArgs(1) { }
16 sub chained_zero_args_0 : Chained(chain_base) PathPart('') Args(0) { $_[1]->res->body('chained_zero_args_0') }
17 sub chained_zero_args_1 : Chained(chain_base) PathPart('') Args(0) { $_[1]->res->body('chained_zero_args_1') }
19 sub chained_one_args_0 : Chained(chain_base) PathPart('') Args(1) { $_[1]->res->body('chained_one_args_0') }
20 sub chained_one_args_1 : Chained(chain_base) PathPart('') Args(1) { $_[1]->res->body('chained_one_args_1') }
22 MyApp::Controller::Root->config(namespace=>'');
32 [debug] Loaded Chained actions:
33 .-----------------------------------------+---------------------------------------------------.
34 | Path Spec | Private |
35 +-----------------------------------------+---------------------------------------------------+
36 | /chain_base/*/* | /chain_base (1) |
37 | | => /chained_one_args_0 (1) |
38 | /chain_base/*/* | /chain_base (1) |
39 | | => /chained_one_args_1 (1) |
40 | /chain_base/* | /chain_base (1) |
41 | | => /chained_zero_args_0 (0) |
42 | /chain_base/* | /chain_base (1) |
43 | | => /chained_zero_args_1 (0) |
44 '-----------------------------------------+---------------------------------------------------'
48 use Catalyst::Test 'MyApp';
51 # Generally if more than one action can match and the path length is equal, we expect
52 # the dispatcher to just take the first one. So this works as expected.
53 my $res = request '/chain_base/capturearg/arg';
54 is $res->content, 'chained_one_args_1', "request '/chain_base/capturearg/arg'";
58 # However this doesn't pass :( For some reason when Args(0), we take the last one that
60 my $res = request '/chain_base/capturearg';
61 is $res->content, 'chained_zero_args_1', "request '/chained_one_args_0/capturearg/arg'";