summaryrefslogtreecommitdiff
path: root/lib/Dancer/Session/PSGI.pm
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-04-21 22:43:23 +0200
committerfranck cuny <franck@lumberjaph.net>2010-04-21 22:43:23 +0200
commit312ebce3dee7af4f1ed8409c67d72e7813818133 (patch)
tree01cef09cd61de79c1f3104b347c4e2b295f2f842 /lib/Dancer/Session/PSGI.pm
parentinitial commit (diff)
downloaddancer-session-psgi-312ebce3dee7af4f1ed8409c67d72e7813818133.tar.gz
use P::M::Session as backend for dancer's sessions
Diffstat (limited to 'lib/Dancer/Session/PSGI.pm')
-rw-r--r--lib/Dancer/Session/PSGI.pm24
1 files changed, 21 insertions, 3 deletions
diff --git a/lib/Dancer/Session/PSGI.pm b/lib/Dancer/Session/PSGI.pm
index 00bb5d6..c530961 100644
--- a/lib/Dancer/Session/PSGI.pm
+++ b/lib/Dancer/Session/PSGI.pm
@@ -4,20 +4,38 @@ use strict;
use warnings;
our $VERSION = '0.01';
+use Dancer::SharedData;
+use base 'Dancer::Session::Abstract';
+
+sub retrieve {
+ my ($class, $id) = @_;
+ my $req = Plack::Request->new(Dancer::SharedData->request->{env});
+ my $session = $req->session();
+ return Dancer::Session::PSGI->new(%$session);
+}
+
+sub flush {
+ my $self = shift;
+ my $req = Plack::Request->new(Dancer::SharedData->request->{env});
+ my $session = $req->session();
+ map {$session->{$_} = $self->{$_}} keys %$self;
+ return $self;
+}
+
1;
__END__
=head1 NAME
-Dancer::Session::PSGI -
+Dancer::Session::PSGI - Let Plack::Middleware::Session handle session
=head1 SYNOPSIS
- use Dancer::Session::PSGI;
+ setting session => 'PSGI'
=head1 DESCRIPTION
-Dancer::Session::PSGI is
+Dancer::Session::PSGI let you use C<Plack::Middleware::Session> as backend for your sessions.
=head1 AUTHOR