line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Web::ComposableRequest::Role::Cookie; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
672
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
12
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
587
|
use CGI::Simple::Cookie; |
|
1
|
|
|
|
|
4047
|
|
|
1
|
|
|
|
|
31
|
|
6
|
1
|
|
|
1
|
|
8
|
use Unexpected::Types qw( HashRef ); |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
11
|
|
7
|
1
|
|
|
1
|
|
501
|
use Web::ComposableRequest::Util qw( add_config_role ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
8
|
1
|
|
|
1
|
|
293
|
use Moo::Role; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
10
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
requires qw( _config _env ); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
add_config_role __PACKAGE__.'::Config'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $_decode = sub { |
15
|
|
|
|
|
|
|
my ($cookies, $prefix, $name) = @_; my $cname = "${prefix}_${name}"; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my $attr = {}; ($name and exists $cookies->{ $cname }) or return $attr; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
for (split m{ \+ }mx, $cookies->{ $cname }->value) { |
20
|
|
|
|
|
|
|
my ($k, $v) = split m{ ~ }mx, $_; $k and $attr->{ $k } = $v; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
return $attr; |
24
|
|
|
|
|
|
|
}; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has 'cookies' => is => 'lazy', isa => HashRef, builder => sub { |
27
|
1
|
|
|
1
|
|
30
|
my %v = CGI::Simple::Cookie->parse( $_[ 0 ]->_env->{ 'HTTP_COOKIE' } ); \%v; |
|
1
|
|
|
|
|
415
|
|
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub get_cookie_hash { |
31
|
4
|
|
|
4
|
1
|
492
|
return $_decode->( $_[ 0 ]->cookies, $_[ 0 ]->_config->prefix, $_[ 1 ] ); |
32
|
|
|
|
|
|
|
}; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
package Web::ComposableRequest::Role::Cookie::Config; |
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
1
|
|
488
|
use namespace::autoclean; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
11
|
|
37
|
|
|
|
|
|
|
|
38
|
1
|
|
|
1
|
|
147
|
use Unexpected::Types qw( NonEmptySimpleStr ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
39
|
1
|
|
|
1
|
|
355
|
use Web::ComposableRequest::Constants qw( TRUE ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
40
|
1
|
|
|
1
|
|
146
|
use Moo::Role; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
has 'prefix' => is => 'ro', isa => NonEmptySimpleStr, required => TRUE; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |