line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dancer::Session::Simple; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:SUKRIA'; |
3
|
|
|
|
|
|
|
#ABSTRACT: in-memory session backend for Dancer |
4
|
|
|
|
|
|
|
$Dancer::Session::Simple::VERSION = '1.3521'; |
5
|
90
|
|
|
90
|
|
45974
|
use strict; |
|
90
|
|
|
|
|
276
|
|
|
90
|
|
|
|
|
2834
|
|
6
|
90
|
|
|
90
|
|
597
|
use warnings; |
|
90
|
|
|
|
|
296
|
|
|
90
|
|
|
|
|
2426
|
|
7
|
90
|
|
|
90
|
|
495
|
use base 'Dancer::Session::Abstract'; |
|
90
|
|
|
|
|
283
|
|
|
90
|
|
|
|
|
43315
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my %sessions; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# create a new session and return the newborn object |
12
|
|
|
|
|
|
|
# representing that session |
13
|
|
|
|
|
|
|
sub create { |
14
|
35
|
|
|
35
|
1
|
1047
|
my ($class) = @_; |
15
|
|
|
|
|
|
|
|
16
|
35
|
|
|
|
|
243
|
my $self = Dancer::Session::Simple->new; |
17
|
35
|
|
|
|
|
190
|
$self->flush; |
18
|
35
|
|
|
|
|
119
|
return $self; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Return the session object corresponding to the given id |
22
|
|
|
|
|
|
|
sub retrieve { |
23
|
67
|
|
|
67
|
1
|
198
|
my ($class, $id) = @_; |
24
|
|
|
|
|
|
|
|
25
|
67
|
|
|
|
|
214
|
return $sessions{$id}; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub destroy { |
30
|
1
|
|
|
1
|
1
|
7
|
my ($self) = @_; |
31
|
1
|
|
|
|
|
4
|
undef $sessions{$self->id}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub flush { |
35
|
43
|
|
|
43
|
1
|
761
|
my $self = shift; |
36
|
43
|
|
|
|
|
159
|
$sessions{$self->id} = $self; |
37
|
43
|
|
|
|
|
104
|
return $self; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |