1 package TestApp::Controller::Action::Chained::CaptureArgs;
5 use base qw( Catalyst::Controller );
8 # This controller build the following patterns of URI:
10 # /captureargs/*/*/edit
14 # It will output the arguments they got passed to @_ after the
16 # /captureargs/one/edit should not dispatch to /captureargs/*/*
17 # /captureargs/test/one should not dispatch to /captureargs/*/*
19 sub base :Chained('/') PathPart('captureargs') CaptureArgs(0) {
20 my ( $self, $c, $arg ) = @_;
21 push @{ $c->stash->{ passed_args } }, 'base';
24 sub two_args :Chained('base') PathPart('') CaptureArgs(2) {
25 my ( $self, $c, $arg1, $arg2 ) = @_;
26 push @{ $c->stash->{ passed_args } }, 'two_args', $arg1, $arg2;
29 sub one_arg :Chained('base') ParthPart('') CaptureArgs(1) {
30 my ( $self, $c, $arg ) = @_;
31 push @{ $c->stash->{ passed_args } }, 'one_arg', $arg;
34 sub edit_two_args :Chained('two_args') PathPart('edit') Args(0) {
35 my ( $self, $c ) = @_;
36 push @{ $c->stash->{ passed_args } }, 'edit_two_args';
39 sub edit_one_arg :Chained('one_arg') PathPart('edit') Args(0) {
40 my ( $self, $c ) = @_;
41 push @{ $c->stash->{ passed_args } }, 'edit_one_arg';
44 sub view_two_args :Chained('two_args') PathPart('') Args(0) {
45 my ( $self, $c ) = @_;
46 push @{ $c->stash->{ passed_args } }, 'view_two_args';
49 sub view_one_arg :Chained('one_arg') PathPart('') Args(0) {
50 my ( $self, $c ) = @_;
51 push @{ $c->stash->{ passed_args } }, 'view_one_arg';
54 sub test_plus_arg :Chained('base') PathPart('test') Args(1) {
55 my ( $self, $c, $arg ) = @_;
56 push @{ $c->stash->{ passed_args } }, 'test_plus_arg', $arg;
61 my ( $self, $c ) = @_;
62 no warnings 'uninitialized';
63 $c->response->body( join '; ', @{ $c->stash->{ passed_args } } );