attempt to get this actually right this time
[catagits/Test-WWW-Mechanize-Catalyst.git] / t / lib / CattySession / Controller / Root.pm
CommitLineData
2140e65c 1package CattySession::Controller::Root;
2
3use strict;
4use warnings;
5
6use base qw/ Catalyst::Controller /;
7
8__PACKAGE__->config( namespace => '' );
9
10sub auto : Private {
11 my ( $self, $context ) = @_;
12 if ( $context->session ) {
13 return 1;
14 }
15
16}
17
18sub default : Private {
19 my ( $self, $context ) = @_;
20 my $html = html( "Root", "This is the root page" );
21 $context->response->content_type("text/html");
22 $context->response->output($html);
23}
24
25sub name : Global {
26 my ($self, $c) = @_;
27
28 my $html = html( $c->config->{name}, "This is the die page" );
29 $c->response->content_type("text/html");
30 $c->response->output($html);
31}
32
33
34sub html {
35 my ( $title, $body ) = @_;
36 return qq{
37<html>
38<head><title>$title</title></head>
39<body>
40$body
41<a href="/hello/">Hello</a>.
42</body></html>
43};
44}
45
461;
47