1 package TestApp::Controller::Action::ChildOf;
6 use base qw/Catalyst::Controller/;
11 # Simple parent/child action test
13 sub foo :PathPart('childof/foo') :Captures(1) :ChildOf('/') { }
14 sub endpoint :PathPart('end') :ChildOf('/action/childof/foo') :Args(1) { }
17 # Parent/child test with two args each
19 sub foo2 :PathPart('childof/foo2') :Captures(2) :ChildOf('/') { }
20 sub endpoint2 :PathPart('end2') :ChildOf('/action/childof/foo2') :Args(2) { }
23 # Relative specification of parent action
25 sub bar :PathPart('childof/bar') :ChildOf('/') { }
26 sub finale :ChildOf('bar') :Args { }
29 # three chain with concurrent endpoints
31 sub one :PathPart('childof/one') :ChildOf('/') :Captures(1) { }
32 sub two :PathPart('two') :ChildOf('/action/childof/one') :Captures(2) { }
33 sub three_end :PathPart('three') :ChildOf('two') :Args(3) { }
34 sub one_end :PathPart('childof/one') :ChildOf('/') :Args(1) { }
35 sub two_end :PathPart('two') :ChildOf('one') :Args(2) { }
38 # Dispatch on number of arguments
40 sub multi1 :PathPart('childof/multi') :ChildOf('/') :Args(1) { }
41 sub multi2 :PathPart('childof/multi') :ChildOf('/') :Args(2) { }
44 # Roots in an action defined in a higher controller
46 sub higher_root :PathPart('bar') :ChildOf('/action/childof/foo/higher_root') :Args(1) { }
49 # Controller -> subcontroller -> controller
51 sub pcp1 :PathPart('childof/pcp1') :ChildOf('/') :Captures(1) { }
52 sub pcp3 :PathPart :ChildOf('/action/childof/foo/pcp2') :Args(1) { }
55 # Dispatch on capture number
57 sub multi_cap1 :PathPart('childof/multi_cap') :ChildOf('/') :Captures(1) { }
58 sub multi_cap2 :PathPart('childof/multi_cap') :ChildOf('/') :Captures(2) { }
59 sub multi_cap_end1 :PathPart('baz') :ChildOf('multi_cap1') :Args(0) { }
60 sub multi_cap_end2 :PathPart('baz') :ChildOf('multi_cap2') :Args(0) { }
63 # Priority: Slurpy args vs. chained actions
65 sub priority_a1 :PathPart('childof/priority_a') :ChildOf('/') :Args { }
66 sub priority_a2 :PathPart('childof/priority_a') :ChildOf('/') :Captures(1) { }
67 sub priority_a2_end :PathPart('end') :ChildOf('priority_a2') :Args(1) { }
70 # Priority: Fixed args vs. chained actions
72 sub priority_b1 :PathPart('childof/priority_b') :ChildOf('/') :Args(3) { }
73 sub priority_b2 :PathPart('childof/priority_b') :ChildOf('/') :Captures(1) { }
74 sub priority_b2_end :PathPart('end') :ChildOf('priority_b2') :Args(1) { }
78 my $out = join('; ', map { join(', ', @$_) }
79 ($c->req->captures, $c->req->args));