1 package TestApp::Controller::Action::Chained;
6 use base qw/Catalyst::Controller/;
12 # :Chained('') means what?
16 # Simple parent/child action test
18 sub foo :PathPart('chained/foo') :Captures(1) :Chained('/') { }
19 sub endpoint :PathPart('end') :Chained('/action/chained/foo') :Args(1) { }
22 # Parent/child test with two args each
24 sub foo2 :PathPart('chained/foo2') :Captures(2) :Chained('/') { }
25 sub endpoint2 :PathPart('end2') :Chained('/action/chained/foo2') :Args(2) { }
28 # Relative specification of parent action
30 sub bar :PathPart('chained/bar') :Chained('/') :Captures(0) { }
31 sub finale :PathPart('') :Chained('bar') :Args { }
34 # three chain with concurrent endpoints
36 sub one :PathPart('chained/one') :Chained('/') :Captures(1) { }
37 sub two :PathPart('two') :Chained('/action/chained/one') :Captures(2) { }
38 sub three_end :PathPart('three') :Chained('two') :Args(3) { }
39 sub one_end :PathPart('chained/one') :Chained('/') :Args(1) { }
40 sub two_end :PathPart('two') :Chained('one') :Args(2) { }
43 # Dispatch on number of arguments
45 sub multi1 :PathPart('chained/multi') :Chained('/') :Args(1) { }
46 sub multi2 :PathPart('chained/multi') :Chained('/') :Args(2) { }
49 # Roots in an action defined in a higher controller
51 sub higher_root :PathPart('bar') :Chained('/action/chained/foo/higher_root') :Args(1) { }
54 # Controller -> subcontroller -> controller
56 sub pcp1 :PathPart('chained/pcp1') :Chained('/') :Captures(1) { }
57 sub pcp3 :Chained('/action/chained/foo/pcp2') :Args(1) { }
60 # Dispatch on capture number
62 sub multi_cap1 :PathPart('chained/multi_cap') :Chained('/') :Captures(1) { }
63 sub multi_cap2 :PathPart('chained/multi_cap') :Chained('/') :Captures(2) { }
64 sub multi_cap_end1 :PathPart('baz') :Chained('multi_cap1') :Args(0) { }
65 sub multi_cap_end2 :PathPart('baz') :Chained('multi_cap2') :Args(0) { }
68 # Priority: Slurpy args vs. chained actions
70 sub priority_a1 :PathPart('chained/priority_a') :Chained('/') :Args { }
71 sub priority_a2 :PathPart('chained/priority_a') :Chained('/') :Captures(1) { }
72 sub priority_a2_end :PathPart('end') :Chained('priority_a2') :Args(1) { }
75 # Priority: Fixed args vs. chained actions
77 sub priority_b1 :PathPart('chained/priority_b') :Chained('/') :Args(3) { }
78 sub priority_b2 :PathPart('chained/priority_b') :Chained('/') :Captures(1) { }
79 sub priority_b2_end :PathPart('end') :Chained('priority_b2') :Args(1) { }
82 # Optional specification of :Args in endpoint
84 sub opt_args :PathPart('chained/opt_args') :Chained('/') { }
87 # Optional PathPart test -> /chained/optpp/*/opt_pathpart/*
89 sub opt_pp_start :Chained('/') :PathPart('chained/optpp') :Captures(1) { }
90 sub opt_pathpart :Chained('opt_pp_start') :Args(1) { }
93 # Optional Args *and* PathPart -> /chained/optall/*/oa/...
95 sub opt_all_start :Chained('/') :PathPart('chained/optall') :Captures(1) { }
96 sub oa :Chained('opt_all_start') { }
99 # :Chained is the same as :Chained('/')
101 sub rootdef :Chained :PathPart('chained/rootdef') :Args(1) { }
104 # the ParentChain controller chains to this action by
105 # specifying :Chained('.')
107 sub parentchain :Chained('/') :PathPart('chained/parentchain') :Captures(1) { }
111 my $out = join('; ', map { join(', ', @$_) }
112 ($c->req->captures, $c->req->args));