Skip to content

Commit

Permalink
Session
Browse files Browse the repository at this point in the history
  • Loading branch information
cho45 committed Oct 9, 2011
1 parent 95bd05a commit 3e278a0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions templates/mywebapp/lib/MyApp/Base.pm
Expand Up @@ -8,6 +8,8 @@ use parent qw(Exporter::Lite);
use Router::Simple;
use Try::Tiny;

use Plack::Session;

use MyApp::Config;
use MyApp::Request;
use MyApp::Response;
Expand Down Expand Up @@ -82,5 +84,11 @@ sub run {
sub req { $_[0]->{req} }
sub res { $_[0]->{res} }

sub session {
$_[0]->{session} //= do {
$_[0]->{req}->env->{'psgix.session'} ? Plack::Session->new($_[0]->{req}->env) : ''
};
}

1;
__END__

0 comments on commit 3e278a0

Please sign in to comment.