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