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.3520'; |
5
|
90
|
|
|
90
|
|
46779
|
use strict; |
|
90
|
|
|
|
|
267
|
|
|
90
|
|
|
|
|
2833
|
|
6
|
90
|
|
|
90
|
|
533
|
use warnings; |
|
90
|
|
|
|
|
242
|
|
|
90
|
|
|
|
|
2586
|
|
7
|
90
|
|
|
90
|
|
569
|
use base 'Dancer::Session::Abstract'; |
|
90
|
|
|
|
|
244
|
|
|
90
|
|
|
|
|
44191
|
|
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
|
1197
|
my ($class) = @_; |
15
|
|
|
|
|
|
|
|
16
|
35
|
|
|
|
|
245
|
my $self = Dancer::Session::Simple->new; |
17
|
35
|
|
|
|
|
216
|
$self->flush; |
18
|
35
|
|
|
|
|
124
|
return $self; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Return the session object corresponding to the given id |
22
|
|
|
|
|
|
|
sub retrieve { |
23
|
67
|
|
|
67
|
1
|
193
|
my ($class, $id) = @_; |
24
|
|
|
|
|
|
|
|
25
|
67
|
|
|
|
|
177
|
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
|
1203
|
my $self = shift; |
36
|
43
|
|
|
|
|
197
|
$sessions{$self->id} = $self; |
37
|
43
|
|
|
|
|
115
|
return $self; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |