line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojo::Cookie::Request; |
2
|
59
|
|
|
59
|
|
68388
|
use Mojo::Base 'Mojo::Cookie'; |
|
59
|
|
|
|
|
257
|
|
|
59
|
|
|
|
|
509
|
|
3
|
|
|
|
|
|
|
|
4
|
59
|
|
|
59
|
|
644
|
use Mojo::Util qw(quote split_header); |
|
59
|
|
|
|
|
177
|
|
|
59
|
|
|
|
|
21557
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub parse { |
7
|
193
|
|
|
193
|
1
|
31630
|
my ($self, $str) = @_; |
8
|
|
|
|
|
|
|
|
9
|
193
|
|
|
|
|
365
|
my @cookies; |
10
|
193
|
|
100
|
|
|
339
|
my @pairs = map {@$_} @{split_header $str // ''}; |
|
74
|
|
|
|
|
364
|
|
|
193
|
|
|
|
|
1061
|
|
11
|
193
|
|
|
|
|
928
|
while (my ($name, $value) = splice @pairs, 0, 2) { |
12
|
171
|
100
|
|
|
|
514
|
next if $name =~ /^\$/; |
13
|
148
|
|
50
|
|
|
516
|
push @cookies, $self->new(name => $name, value => $value // ''); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
193
|
|
|
|
|
1118
|
return \@cookies; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub to_string { |
20
|
399
|
|
|
399
|
1
|
652
|
my $self = shift; |
21
|
399
|
100
|
100
|
|
|
1424
|
return '' unless length(my $name = $self->name // ''); |
22
|
398
|
|
100
|
|
|
1446
|
my $value = $self->value // ''; |
23
|
398
|
100
|
|
|
|
4375
|
return join '=', $name, $value =~ /[,;" ]/ ? quote $value : $value; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=encoding utf8 |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 NAME |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Mojo::Cookie::Request - HTTP request cookie |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 SYNOPSIS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
use Mojo::Cookie::Request; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
my $cookie = Mojo::Cookie::Request->new; |
39
|
|
|
|
|
|
|
$cookie->name('foo'); |
40
|
|
|
|
|
|
|
$cookie->value('bar'); |
41
|
|
|
|
|
|
|
say "$cookie"; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 DESCRIPTION |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
L is a container for HTTP request cookies, based on L
|
46
|
|
|
|
|
|
|
6265|https://tools.ietf.org/html/rfc6265>. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
L inherits all attributes from L. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 METHODS |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
L inherits all methods from L and implements the following new ones. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 parse |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
my $cookies = Mojo::Cookie::Request->parse('f=b; g=a'); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Parse cookies. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 to_string |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
my $str = $cookie->to_string; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Render cookie. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 SEE ALSO |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
L, L, L. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |