line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MojoX::Session::Transport::Cookie; |
2
|
|
|
|
|
|
|
|
3
|
15
|
|
|
15
|
|
75
|
use strict; |
|
15
|
|
|
|
|
23
|
|
|
15
|
|
|
|
|
552
|
|
4
|
15
|
|
|
15
|
|
69
|
use warnings; |
|
15
|
|
|
|
|
24
|
|
|
15
|
|
|
|
|
461
|
|
5
|
|
|
|
|
|
|
|
6
|
15
|
|
|
15
|
|
64
|
use base 'MojoX::Session::Transport'; |
|
15
|
|
|
|
|
23
|
|
|
15
|
|
|
|
|
5922
|
|
7
|
|
|
|
|
|
|
|
8
|
15
|
|
|
15
|
|
90
|
use Mojo::Cookie::Request; |
|
15
|
|
|
|
|
21
|
|
|
15
|
|
|
|
|
150
|
|
9
|
15
|
|
|
15
|
|
324
|
use Mojo::Cookie::Response; |
|
15
|
|
|
|
|
20
|
|
|
15
|
|
|
|
|
205
|
|
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
|
14
|
my ($self) = @_; |
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
|
|
35
|
my $cookies = $self->tx->req->cookies; |
19
|
2
|
50
|
|
|
|
295
|
return unless $cookies; |
20
|
|
|
|
|
|
|
|
21
|
2
|
|
|
|
|
3
|
my $sid; |
22
|
2
|
|
|
|
|
6
|
foreach my $cookie (@$cookies) { |
23
|
3
|
100
|
|
|
|
87
|
if ($cookie->name eq $self->name) { |
24
|
2
|
|
|
|
|
97
|
return $cookie->value; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
0
|
return; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub set { |
32
|
18
|
|
|
18
|
1
|
164
|
my ($self, $sid, $expires) = @_; |
33
|
|
|
|
|
|
|
|
34
|
18
|
|
|
|
|
218
|
my $cookie = Mojo::Cookie::Response->new; |
35
|
|
|
|
|
|
|
|
36
|
18
|
|
|
|
|
508
|
$cookie->name($self->name)->value($sid); |
37
|
18
|
|
|
|
|
1945
|
$cookie->path($self->path); |
38
|
18
|
|
|
|
|
852
|
$cookie->domain($self->domain); |
39
|
18
|
|
|
|
|
1491
|
$cookie->httponly($self->httponly); |
40
|
18
|
|
|
|
|
812
|
$cookie->secure($self->secure); |
41
|
18
|
|
|
|
|
815
|
$cookie->expires($expires); |
42
|
|
|
|
|
|
|
|
43
|
18
|
100
|
|
|
|
181
|
$cookie->max_age(0) if $expires < time; |
44
|
|
|
|
|
|
|
|
45
|
18
|
|
|
|
|
360
|
$self->tx->res->cookies($cookie); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
__END__ |