Commit | Line | Data |
6bc86362 |
1 | package CattySession; |
2 | |
3 | use strict; |
4 | |
5 | #use Catalyst; |
db8bd5bb |
6 | use Catalyst qw/ |
6bc86362 |
7 | Session |
8 | Session::State::Cookie |
9 | Session::Store::Dummy |
10 | /; |
11 | use Cwd; |
12 | use MIME::Base64; |
13 | |
14 | our $VERSION = '0.01'; |
15 | |
16 | CattySession->config( |
17 | name => 'CattySession', |
18 | root => cwd . '/t/root', |
19 | ); |
20 | |
21 | CattySession->setup(); |
22 | |
23 | sub auto : Private { |
24 | my ( $self, $context ) = @_; |
25 | if ( $context->session ) { |
26 | return 1; |
27 | } |
28 | |
29 | } |
30 | |
31 | sub 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 | |
38 | sub html { |
39 | my ( $title, $body ) = @_; |
40 | return qq{ |
41 | <html> |
42 | <head><title>$title</title></head> |
43 | <body> |
44 | $body |
45 | <a href="/hello/">Hello</a>. |
46 | </body></html> |
47 | }; |
48 | } |
49 | |
50 | 1; |
51 | |