line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Web::ComposableRequest::Role::Cookie; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
508
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
472
|
use CGI::Simple::Cookie; |
|
1
|
|
|
|
|
3336
|
|
|
1
|
|
|
|
|
24
|
|
6
|
1
|
|
|
1
|
|
5
|
use Unexpected::Types qw( HashRef ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
7
|
1
|
|
|
1
|
|
355
|
use Web::ComposableRequest::Util qw( add_config_role ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
8
|
1
|
|
|
1
|
|
232
|
use Moo::Role; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
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
|
|
16
|
my %v = CGI::Simple::Cookie->parse( $_[ 0 ]->_env->{ 'HTTP_COOKIE' } ); \%v; |
|
1
|
|
|
|
|
279
|
|
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub get_cookie_hash { |
31
|
4
|
|
|
4
|
1
|
368
|
return $_decode->( $_[ 0 ]->cookies, $_[ 0 ]->_config->prefix, $_[ 1 ] ); |
32
|
|
|
|
|
|
|
}; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
package Web::ComposableRequest::Role::Cookie::Config; |
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
1
|
|
400
|
use namespace::autoclean; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
37
|
|
|
|
|
|
|
|
38
|
1
|
|
|
1
|
|
47
|
use Unexpected::Types qw( NonEmptySimpleStr ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
39
|
1
|
|
|
1
|
|
316
|
use Web::ComposableRequest::Constants qw( TRUE ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
40
|
1
|
|
|
1
|
|
131
|
use Moo::Role; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
has 'prefix' => is => 'ro', isa => NonEmptySimpleStr, required => TRUE; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |