Adding Test::WWW::Selenium::Catalyst
[catagits/Test-WWW-Selenium-Catalyst.git] / t / lib / TestApp / Controller / Root.pm
CommitLineData
4f6d213e 1#!/usr/bin/perl\r
2# Root.pm \r
3# Copyright (c) 2006 Jonathan Rockway <jrockway@cpan.org>\r
4\r
5package TestApp::Controller::Root;\r
6use base qw(Catalyst::Controller);\r
7__PACKAGE__->config->{namespace} = q{};\r
8my @words = qw(foo bar baz bat qux quux);\r
9\r
10sub index : Private {\r
11 my ($self, $c, @args) = @_;\r
12 my $words = $c->uri_for('/words');\r
13 $c->response->body(<<"HERE");\r
14<html>\r
15<head>\r
16<title>TestApp</title>\r
17</head>\r
18<body>\r
19<h1>TestApp</h1>\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
22</body>\r
23</html> \r
24HERE\r
25}\r
26\r
27sub words : Local {\r
28 my ($self, $c, $times) = @_;\r
29 $times ||= 0;\r
30 my $html = <<"HEADER";\r
31<html>\r
32<head>\r
33<title>TestApp</title>\r
34</head>\r
35<body>\r
36<h1>TestApp &lt;&lt; Words</h1>\r
37<p>Here you'll find all things "words" printed $times time(s)!</p>\r
38<ul>\r
39HEADER\r
40 local $" = q{ }; # single space\r
41 $html .= " <li>$_: @words</li>\n" for 1..$times;\r
42 $html .= <<"FOOTER"; \r
43</ul>\r
44</body>\r
45</html>\r
46FOOTER\r
47 $c->response->body($html);\r
48}\r
49\r
50sub null : Path('/favicon.ico'){\r
51 my ($self, $c) = @_;\r
52 $c->response->status(404); # doesn't exist\r
53}\r
54\r
551; # true.\r
56\r