Support testing against two apps in same perl interpreter
[catagits/Test-WWW-Mechanize-Catalyst.git] / t / lib / CattySession.pm
CommitLineData
6bc86362 1package CattySession;
2
3use strict;
4
5#use Catalyst;
db8bd5bb 6use Catalyst qw/
6bc86362 7 Session
8 Session::State::Cookie
9 Session::Store::Dummy
10 /;
11use Cwd;
12use MIME::Base64;
13
14our $VERSION = '0.01';
15
16CattySession->config(
17 name => 'CattySession',
18 root => cwd . '/t/root',
19);
20
21CattySession->setup();
22
23sub auto : Private {
24 my ( $self, $context ) = @_;
25 if ( $context->session ) {
26 return 1;
27 }
28
29}
30
31sub default : Private {
32 my ( $self, $context ) = @_;
33 my $html = html( "Root", "This is the root page" );
34 $context->response->content_type("text/html");
35 $context->response->output($html);
36}
37
254eca41 38sub name : Global {
39 my ($self, $c) = @_;
40
41 my $html = html( $c->config->{name}, "This is the die page" );
42 $c->response->content_type("text/html");
43 $c->response->output($html);
44}
45
46
6bc86362 47sub html {
48 my ( $title, $body ) = @_;
49 return qq{
50<html>
51<head><title>$title</title></head>
52<body>
53$body
54<a href="/hello/">Hello</a>.
55</body></html>
56};
57}
58
591;
60