blob: c530961e051de48f41acfc0ebef4bd6aad5c1d52 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
package Dancer::Session::PSGI;
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 - Let Plack::Middleware::Session handle session
=head1 SYNOPSIS
setting session => 'PSGI'
=head1 DESCRIPTION
Dancer::Session::PSGI let you use C<Plack::Middleware::Session> as backend for your sessions.
=head1 AUTHOR
franck cuny E<lt>franck@lumberjaph.netE<gt>
=head1 SEE ALSO
=head1 LICENSE
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
|