line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Plack::Session; |
2
|
5
|
|
|
5
|
|
472303
|
use strict; |
|
5
|
|
|
|
|
18
|
|
|
5
|
|
|
|
|
123
|
|
3
|
5
|
|
|
5
|
|
23
|
use warnings; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
219
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.33'; |
6
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:STEVAN'; |
7
|
|
|
|
|
|
|
|
8
|
5
|
|
|
5
|
|
1332
|
use Plack::Util::Accessor qw( session options ); |
|
5
|
|
|
|
|
955
|
|
|
5
|
|
|
|
|
28
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
36
|
|
|
36
|
1
|
308
|
my ($class, $env) = @_; |
12
|
|
|
|
|
|
|
bless { |
13
|
|
|
|
|
|
|
session => $env->{'psgix.session'}, |
14
|
36
|
|
|
|
|
118
|
options => $env->{'psgix.session.options'}, |
15
|
|
|
|
|
|
|
}, $class; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub id { |
19
|
40
|
|
|
40
|
1
|
2395
|
my $self = shift; |
20
|
40
|
|
|
|
|
80
|
$self->options->{id}; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
## Data Managment |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub dump { |
26
|
36
|
|
|
36
|
1
|
22130
|
my $self = shift; |
27
|
36
|
|
|
|
|
94
|
$self->session; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub get { |
31
|
60
|
|
|
60
|
1
|
24483
|
my ($self, $key) = @_; |
32
|
60
|
|
|
|
|
137
|
$self->session->{$key}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub set { |
36
|
20
|
|
|
20
|
1
|
7085
|
my ($self, $key, $value) = @_; |
37
|
20
|
|
|
|
|
53
|
delete $self->options->{no_store}; |
38
|
20
|
|
|
|
|
90
|
$self->session->{$key} = $value; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub remove { |
42
|
4
|
|
|
4
|
1
|
2009
|
my ($self, $key) = @_; |
43
|
4
|
|
|
|
|
15
|
delete $self->options->{no_store}; |
44
|
4
|
|
|
|
|
20
|
delete $self->session->{$key}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub keys { |
48
|
4
|
|
|
4
|
1
|
9
|
my $self = shift; |
49
|
4
|
|
|
|
|
6
|
keys %{$self->session}; |
|
4
|
|
|
|
|
12
|
|
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
## Lifecycle Management |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub expire { |
55
|
4
|
|
|
4
|
1
|
2118
|
my $self = shift; |
56
|
4
|
|
|
|
|
14
|
for my $key ($self->keys) { |
57
|
8
|
|
|
|
|
43
|
delete $self->session->{$key}; |
58
|
|
|
|
|
|
|
} |
59
|
4
|
|
|
|
|
22
|
$self->options->{expire} = 1; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
__END__ |