3 # Copyright (c) 2006 Jonathan Rockway <jrockway@cpan.org>
\r
5 package TestApp::Controller::Root;
\r
6 use base qw(Catalyst::Controller);
\r
7 __PACKAGE__->config->{namespace} = q{};
\r
8 my @words = qw(foo bar baz bat qux quux);
\r
10 sub index : Private {
\r
11 my ($self, $c, @args) = @_;
\r
12 my $words = $c->uri_for('/words');
\r
13 $c->response->body(<<"HERE");
\r
16 <title>TestApp</title>
\r
20 <p>This is the TestApp.</p>
\r
21 <p><a href="$words">Click here</a> to <i>see</i> some words.</p>
\r
28 my ($self, $c, $times) = @_;
\r
30 my $html = <<"HEADER";
\r
33 <title>TestApp</title>
\r
36 <h1>TestApp << Words</h1>
\r
37 <p>Here you'll find all things "words" printed $times time(s)!</p>
\r
40 local $" = q{ }; # single space
\r
41 $html .= " <li>$_: @words</li>\n" for 1..$times;
\r
42 $html .= <<"FOOTER";
\r
47 $c->response->body($html);
\r
50 sub null : Path('/favicon.ico'){
\r
51 my ($self, $c) = @_;
\r
52 $c->response->status(404); # doesn't exist
\r