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