line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MojoX::Session::Transport::Cookie; |
2
|
|
|
|
|
|
|
|
3
|
15
|
|
|
15
|
|
88
|
use strict; |
|
15
|
|
|
|
|
30
|
|
|
15
|
|
|
|
|
559
|
|
4
|
15
|
|
|
15
|
|
79
|
use warnings; |
|
15
|
|
|
|
|
29
|
|
|
15
|
|
|
|
|
475
|
|
5
|
|
|
|
|
|
|
|
6
|
15
|
|
|
15
|
|
77
|
use base 'MojoX::Session::Transport'; |
|
15
|
|
|
|
|
22
|
|
|
15
|
|
|
|
|
8283
|
|
7
|
|
|
|
|
|
|
|
8
|
15
|
|
|
15
|
|
88
|
use Mojo::Cookie::Request; |
|
15
|
|
|
|
|
29
|
|
|
15
|
|
|
|
|
151
|
|
9
|
15
|
|
|
15
|
|
354
|
use Mojo::Cookie::Response; |
|
15
|
|
|
|
|
38
|
|
|
15
|
|
|
|
|
157
|
|
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
|
18
|
my ($self) = @_; |
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
|
|
44
|
my $cookies = $self->tx->req->cookies; |
19
|
2
|
50
|
|
|
|
322
|
return unless $cookies; |
20
|
|
|
|
|
|
|
|
21
|
2
|
|
|
|
|
3
|
my $sid; |
22
|
2
|
|
|
|
|
7
|
foreach my $cookie (@$cookies) { |
23
|
3
|
100
|
|
|
|
102
|
if ($cookie->name eq $self->name) { |
24
|
2
|
|
|
|
|
104
|
return $cookie->value; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
0
|
return; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub set { |
32
|
18
|
|
|
18
|
1
|
193
|
my ($self, $sid, $expires) = @_; |
33
|
|
|
|
|
|
|
|
34
|
18
|
|
|
|
|
194
|
my $cookie = Mojo::Cookie::Response->new; |
35
|
|
|
|
|
|
|
|
36
|
18
|
|
|
|
|
660
|
$cookie->name($self->name)->value($sid); |
37
|
18
|
|
|
|
|
2409
|
$cookie->path($self->path); |
38
|
18
|
|
|
|
|
3254
|
$cookie->domain($self->domain); |
39
|
18
|
|
|
|
|
8495
|
$cookie->httponly($self->httponly); |
40
|
18
|
|
|
|
|
1083
|
$cookie->secure($self->secure); |
41
|
18
|
|
|
|
|
641
|
$cookie->expires($expires); |
42
|
|
|
|
|
|
|
|
43
|
18
|
100
|
|
|
|
233
|
$cookie->max_age(0) if $expires < time; |
44
|
|
|
|
|
|
|
|
45
|
18
|
|
|
|
|
423
|
$self->tx->res->cookies($cookie); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
__END__ |