ChildOf Tests: chaining and dispatching on arg count
[catagits/Catalyst-Runtime.git] / t / lib / TestApp / Controller / Action / ChildOf.pm
1 package TestApp::Controller::Action::ChildOf;
2
3 use strict;
4 use warnings;
5
6 use base qw/Catalyst::Controller/;
7
8 sub begin :Private { }
9
10 sub foo  :PathPart('childof/foo')  :Captures(1) :ChildOf('/') { }
11 sub foo2 :PathPart('childof/foo2') :Captures(2) :ChildOf('/') { }
12
13 sub bar :PathPart('childof/bar') :ChildOf('/') { }
14
15 sub endpoint  :PathPart('end')  :ChildOf('/action/childof/foo')  :Args(1) { }
16 sub endpoint2 :PathPart('end2') :ChildOf('/action/childof/foo2') :Args(2) { }
17
18 sub finale :ChildOf('bar') :Args { }
19
20 sub one   :PathPart('childof/one') :ChildOf('/')                   :Captures(1) { }
21 sub two   :PathPart('two')         :ChildOf('/action/childof/one') :Captures(2) { }
22
23 sub three_end :PathPart('three')       :ChildOf('two') :Args(3) { }
24 sub one_end   :PathPart('childof/one') :ChildOf('/')   :Args(1) { }
25 sub two_end   :PathPart('two')         :ChildOf('one') :Args(2) { }
26
27 sub multi1 :PathPart('childof/multi') :ChildOf('/') :Args(1) { }
28 sub multi2 :PathPart('childof/multi') :ChildOf('/') :Args(2) { }
29
30 sub end :Private {
31   my ($self, $c) = @_;
32   my $out = join('; ', map { join(', ', @$_) }
33                          ($c->req->captures, $c->req->args));
34   $c->res->body($out);
35 }
36
37 1;