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