Commit | Line | Data |
c4057ce2 |
1 | package MyApp1::Controller::C1; |
2 | |
3 | use Moose; |
4 | use CatalystX::Routes; |
5 | |
69d9fc4e |
6 | BEGIN { extends 'Catalyst::Controller' } |
c4057ce2 |
7 | |
69d9fc4e |
8 | our %REQ; |
9 | |
10 | sub _get { $REQ{get}++ } |
11 | sub _get_html { $REQ{get_html}++ } |
12 | sub _post { $REQ{post}++ } |
13 | sub _put { $REQ{put}++ } |
14 | sub _del { $REQ{delete}++ } |
c4057ce2 |
15 | |
16 | get '/foo' => \&_get; |
17 | |
18 | get_html '/foo' => \&_get_html; |
19 | |
20 | post '/foo' => \&_post; |
21 | |
22 | put '/foo' => \&_put; |
23 | |
24 | del '/foo' => \&_del; |
25 | |
77d62699 |
26 | get 'bar'=> \&_get; |
27 | |
28 | get_html 'bar'=> \&_get_html; |
29 | |
30 | post 'bar'=> \&_post; |
31 | |
32 | put 'bar'=> \&_put; |
33 | |
34 | del 'bar'=> \&_del; |
35 | |
73bef299 |
36 | chain_point '_set_chain1' |
37 | => chained '/' |
38 | => path_part 'chain1' |
39 | => capture_args 1 |
40 | => sub { $REQ{chain1} = $_[2] }; |
41 | |
42 | chain_point '_set_chain2' |
43 | => chained '_set_chain1' |
44 | => path_part 'chain2' |
45 | => capture_args 1 |
46 | => sub { $REQ{chain2} = $_[2] }; |
47 | |
48 | get 'baz' |
49 | => chained '_set_chain2' |
50 | => args 1 |
51 | => sub { $REQ{baz} = $_[2] }; |
52 | |
69d9fc4e |
53 | sub normal : Chained('/') : Args(0) { |
54 | $REQ{normal}++; |
55 | } |
56 | |
c4057ce2 |
57 | 1; |