line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Starch::Plugin::CookieArgs::State; |
2
|
|
|
|
|
|
|
our $VERSION = '0.14'; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
550
|
use Moo::Role; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
5
|
1
|
|
|
1
|
|
335
|
use strictures 2; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
39
|
|
6
|
1
|
|
|
1
|
|
230
|
use namespace::clean; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
with 'Starch::Plugin::ForState'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub cookie_args { |
11
|
2
|
|
|
2
|
0
|
18
|
my ($self) = @_; |
12
|
|
|
|
|
|
|
|
13
|
2
|
100
|
|
|
|
12
|
return $self->cookie_delete_args() if $self->is_deleted(); |
14
|
1
|
|
|
|
|
6
|
return $self->cookie_set_args(); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub cookie_set_args { |
18
|
6
|
|
|
6
|
0
|
15
|
my ($self) = @_; |
19
|
|
|
|
|
|
|
|
20
|
6
|
|
|
|
|
87
|
my $expires = $self->expires(); |
21
|
|
|
|
|
|
|
|
22
|
6
|
50
|
|
|
|
103
|
my $args = { |
23
|
|
|
|
|
|
|
name => $self->manager->cookie_name(), |
24
|
|
|
|
|
|
|
value => $self->id(), |
25
|
|
|
|
|
|
|
$expires ? (expires => "+${expires}s") : (), |
26
|
|
|
|
|
|
|
domain => $self->manager->cookie_domain(), |
27
|
|
|
|
|
|
|
path => $self->manager->cookie_path(), |
28
|
|
|
|
|
|
|
secure => $self->manager->cookie_secure(), |
29
|
|
|
|
|
|
|
httponly => $self->manager->cookie_http_only(), |
30
|
|
|
|
|
|
|
}; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# Filter out undefined values. |
33
|
|
|
|
|
|
|
return { |
34
|
42
|
|
|
|
|
94
|
map { $_ => $args->{$_} } |
35
|
6
|
|
|
|
|
51
|
grep { defined $args->{$_} } |
|
42
|
|
|
|
|
63
|
|
36
|
|
|
|
|
|
|
keys( %$args ) |
37
|
|
|
|
|
|
|
}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub cookie_delete_args { |
41
|
3
|
|
|
3
|
0
|
11
|
my ($self) = @_; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
return { |
44
|
3
|
|
|
|
|
4
|
%{ $self->cookie_set_args() }, |
|
3
|
|
|
|
|
7
|
|
45
|
|
|
|
|
|
|
expires => '-1d', |
46
|
|
|
|
|
|
|
}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |