Commit | Line | Data |
30726632 |
1 | package ESITest::Controller::Root; |
2 | |
3 | use strict; |
4 | use warnings; |
9e1146e4 |
5 | use base 'Catalyst::Controller'; |
30726632 |
6 | |
7 | __PACKAGE__->config->{namespace} = ''; |
8 | |
7b1b8afd |
9 | sub auto : Private { |
30726632 |
10 | my ( $self, $c ) = @_; |
7b1b8afd |
11 | $c->stash->{'current_view'} = 'TT'; |
12 | return 1; |
30726632 |
13 | } |
14 | |
7b1b8afd |
15 | sub index :Path Args(0) {} |
16 | |
17 | sub base : Chained('/') PathPart('') CaptureArgs(0) {} |
e88af283 |
18 | |
19 | sub time_include : Chained('base') PathPart('time') Args(0) { |
30726632 |
20 | my ( $self, $c ) = @_; |
3c5cb6d6 |
21 | my $params = $c->req->params; |
22 | |
23 | $c->stash->{current_time} = localtime(); |
24 | |
25 | my $additional = ''; |
26 | for my $key (keys %$params) { |
27 | $additional .= "| $key = $params->{$key} | " |
28 | } |
29 | |
30 | $c->stash->{additional} = $additional; |
31 | |
32 | } |
33 | |
34 | sub capture : Chained('base') PathPart('') CaptureArgs(1) { |
35 | my ( $self, $c, $arg ) = @_; |
c33bb236 |
36 | $c->log->debug("Capture: $arg") if $c->debug; |
9c2c47b0 |
37 | $c->stash->{additional} = "Capture Arg: $arg"; |
3c5cb6d6 |
38 | } |
39 | |
40 | sub time_args : Chained('capture') PathPart('time') Args(0) { |
41 | my ( $self, $c ) = @_; |
42 | my $params = $c->req->params; |
43 | |
30726632 |
44 | $c->stash->{current_time} = localtime(); |
3c5cb6d6 |
45 | |
46 | my $additional = $c->stash->{additional}; |
47 | for my $key (keys %$params) { |
48 | $additional .= "| $key = $params->{$key} | " |
49 | } |
50 | |
51 | $c->stash->{additional} = $additional; |
52 | |
53 | $c->stash->{template} = 'time_include.tt'; |
30726632 |
54 | } |
55 | |
9c2c47b0 |
56 | sub time_args_with_args : Chained('capture') PathPart('time') Args(1) { |
57 | my ( $self, $c, $arg ) = @_; |
58 | my $params = $c->req->params; |
59 | |
60 | $c->stash->{current_time} = localtime(); |
61 | |
62 | my $additional = $c->stash->{additional}; |
63 | for my $key (keys %$params) { |
64 | $additional .= " | $key = $params->{$key} | " |
65 | } |
66 | |
67 | $additional .= " Action Arg: $arg "; |
68 | |
69 | $c->stash->{additional} = $additional; |
70 | |
71 | $c->stash->{template} = 'time_include.tt'; |
72 | } |
73 | |
74 | sub time_args_without_capture : Chained('base') PathPart('time') Args(1) { |
75 | my ( $self, $c, $arg ) = @_; |
76 | my $params = $c->req->params; |
77 | |
78 | $c->stash->{current_time} = localtime(); |
79 | |
80 | my $additional = ''; |
81 | for my $key (keys %$params) { |
82 | $additional .= " | $key = $params->{$key} | " |
83 | } |
84 | |
85 | $additional .= " Action Arg: $arg "; |
86 | |
87 | $c->stash->{additional} = $additional; |
88 | |
89 | $c->stash->{template} = 'time_include.tt'; |
90 | } |
91 | |
f61393b7 |
92 | sub time_args_no_chained : Path('time_args_no_chained') Args { |
93 | my ($self, $c, @args) = @_; |
94 | |
95 | my $params = $c->req->params; |
96 | |
97 | $c->stash->{current_time} = localtime(); |
98 | |
99 | my $additional = ''; |
100 | for my $key (keys %$params) { |
101 | $additional .= " | $key = $params->{$key} | " |
102 | } |
103 | |
104 | $additional .= " No Chained Args: " . join ', ', @args; |
105 | |
106 | $c->stash->{additional} = $additional; |
107 | |
108 | $c->stash->{template} = 'time_include.tt'; |
109 | } |
110 | |
7b1b8afd |
111 | sub http : Chained('base') PathPart('') CaptureArgs(0) { |
112 | pop->stash->{'current_view'} = 'TTWithHTTP'; |
113 | } |
114 | |
115 | sub http_cpan : Chained('http') Args(0) {} |
116 | |
117 | sub http_github : Chained('http') Args(0) {} |
118 | |
30726632 |
119 | sub end : ActionClass('RenderView') {} |
120 | |
121 | 1; |