line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MojoX::Session::Transport::Cookie; |
2
|
|
|
|
|
|
|
|
3
|
15
|
|
|
15
|
|
69
|
use strict; |
|
15
|
|
|
|
|
22
|
|
|
15
|
|
|
|
|
736
|
|
4
|
15
|
|
|
15
|
|
64
|
use warnings; |
|
15
|
|
|
|
|
22
|
|
|
15
|
|
|
|
|
414
|
|
5
|
|
|
|
|
|
|
|
6
|
15
|
|
|
15
|
|
57
|
use base 'MojoX::Session::Transport'; |
|
15
|
|
|
|
|
22
|
|
|
15
|
|
|
|
|
5589
|
|
7
|
|
|
|
|
|
|
|
8
|
15
|
|
|
15
|
|
81
|
use Mojo::Cookie::Request; |
|
15
|
|
|
|
|
20
|
|
|
15
|
|
|
|
|
133
|
|
9
|
15
|
|
|
15
|
|
292
|
use Mojo::Cookie::Response; |
|
15
|
|
|
|
|
21
|
|
|
15
|
|
|
|
|
175
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
__PACKAGE__->attr(name => 'sid'); |
12
|
|
|
|
|
|
|
__PACKAGE__->attr(path => '/'); |
13
|
|
|
|
|
|
|
__PACKAGE__->attr([qw/domain httponly secure/]); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub get { |
16
|
2
|
|
|
2
|
1
|
17
|
my ($self) = @_; |
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
|
|
41
|
my $cookies = $self->tx->req->cookies; |
19
|
2
|
50
|
|
|
|
292
|
return unless $cookies; |
20
|
|
|
|
|
|
|
|
21
|
2
|
|
|
|
|
3
|
my $sid; |
22
|
2
|
|
|
|
|
8
|
foreach my $cookie (@$cookies) { |
23
|
3
|
100
|
|
|
|
83
|
if ($cookie->name eq $self->name) { |
24
|
2
|
|
|
|
|
102
|
return $cookie->value; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
0
|
return; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub set { |
32
|
18
|
|
|
18
|
1
|
131
|
my ($self, $sid, $expires) = @_; |
33
|
|
|
|
|
|
|
|
34
|
18
|
|
|
|
|
135
|
my $cookie = Mojo::Cookie::Response->new; |
35
|
|
|
|
|
|
|
|
36
|
18
|
|
|
|
|
413
|
$cookie->name($self->name)->value($sid); |
37
|
18
|
|
|
|
|
1690
|
$cookie->path($self->path); |
38
|
18
|
|
|
|
|
725
|
$cookie->domain($self->domain); |
39
|
18
|
|
|
|
|
694
|
$cookie->httponly($self->httponly); |
40
|
18
|
|
|
|
|
737
|
$cookie->secure($self->secure); |
41
|
18
|
|
|
|
|
859
|
$cookie->expires($expires); |
42
|
|
|
|
|
|
|
|
43
|
18
|
100
|
|
|
|
169
|
$cookie->max_age(0) if $expires < time; |
44
|
|
|
|
|
|
|
|
45
|
18
|
|
|
|
|
314
|
$self->tx->res->cookies($cookie); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
__END__ |