1 package ESITest::Controller::Root;
5 use base 'Catalyst::Controller';
7 __PACKAGE__->config->{namespace} = '';
10 my ( $self, $c ) = @_;
11 $c->stash->{'current_view'} = 'TT';
15 sub index :Path Args(0) {}
17 sub base : Chained('/') PathPart('') CaptureArgs(0) {}
19 sub time_include : Chained('base') PathPart('time') Args(0) {
20 my ( $self, $c ) = @_;
21 my $params = $c->req->params;
23 $c->stash->{current_time} = localtime();
26 for my $key (keys %$params) {
27 $additional .= "| $key = $params->{$key} | "
30 $c->stash->{additional} = $additional;
34 sub capture : Chained('base') PathPart('') CaptureArgs(1) {
35 my ( $self, $c, $arg ) = @_;
36 $c->log->debug("Capture: $arg") if $c->debug;
37 $c->stash->{additional} = "Capture Arg: $arg";
40 sub time_args : Chained('capture') PathPart('time') Args(0) {
41 my ( $self, $c ) = @_;
42 my $params = $c->req->params;
44 $c->stash->{current_time} = localtime();
46 my $additional = $c->stash->{additional};
47 for my $key (keys %$params) {
48 $additional .= "| $key = $params->{$key} | "
51 $c->stash->{additional} = $additional;
53 $c->stash->{template} = 'time_include.tt';
56 sub time_args_with_args : Chained('capture') PathPart('time') Args(1) {
57 my ( $self, $c, $arg ) = @_;
58 my $params = $c->req->params;
60 $c->stash->{current_time} = localtime();
62 my $additional = $c->stash->{additional};
63 for my $key (keys %$params) {
64 $additional .= " | $key = $params->{$key} | "
67 $additional .= " Action Arg: $arg ";
69 $c->stash->{additional} = $additional;
71 $c->stash->{template} = 'time_include.tt';
74 sub time_args_without_capture : Chained('base') PathPart('time') Args(1) {
75 my ( $self, $c, $arg ) = @_;
76 my $params = $c->req->params;
78 $c->stash->{current_time} = localtime();
81 for my $key (keys %$params) {
82 $additional .= " | $key = $params->{$key} | "
85 $additional .= " Action Arg: $arg ";
87 $c->stash->{additional} = $additional;
89 $c->stash->{template} = 'time_include.tt';
92 sub time_args_no_chained : Path('time_args_no_chained') Args {
93 my ($self, $c, @args) = @_;
95 my $params = $c->req->params;
97 $c->stash->{current_time} = localtime();
100 for my $key (keys %$params) {
101 $additional .= " | $key = $params->{$key} | "
104 $additional .= " No Chained Args: " . join ', ', @args;
106 $c->stash->{additional} = $additional;
108 $c->stash->{template} = 'time_include.tt';
111 sub http : Chained('base') PathPart('') CaptureArgs(0) {
112 pop->stash->{'current_view'} = 'TTWithHTTP';
115 sub http_cpan : Chained('http') Args(0) {}
117 sub http_github : Chained('http') Args(0) {}
119 sub end : ActionClass('RenderView') {}