line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojo::Cookie::Request; |
2
|
60
|
|
|
60
|
|
72837
|
use Mojo::Base 'Mojo::Cookie'; |
|
60
|
|
|
|
|
313
|
|
|
60
|
|
|
|
|
442
|
|
3
|
|
|
|
|
|
|
|
4
|
60
|
|
|
60
|
|
710
|
use Mojo::Util qw(quote split_header); |
|
60
|
|
|
|
|
287
|
|
|
60
|
|
|
|
|
22225
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub parse { |
7
|
197
|
|
|
197
|
1
|
31450
|
my ($self, $str) = @_; |
8
|
|
|
|
|
|
|
|
9
|
197
|
|
|
|
|
359
|
my @cookies; |
10
|
197
|
|
100
|
|
|
367
|
my @pairs = map {@$_} @{split_header $str // ''}; |
|
74
|
|
|
|
|
350
|
|
|
197
|
|
|
|
|
1077
|
|
11
|
197
|
|
|
|
|
964
|
while (my ($name, $value) = splice @pairs, 0, 2) { |
12
|
171
|
100
|
|
|
|
550
|
next if $name =~ /^\$/; |
13
|
148
|
|
50
|
|
|
500
|
push @cookies, $self->new(name => $name, value => $value // ''); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
197
|
|
|
|
|
1102
|
return \@cookies; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub to_string { |
20
|
399
|
|
|
399
|
1
|
652
|
my $self = shift; |
21
|
399
|
100
|
100
|
|
|
933
|
return '' unless length(my $name = $self->name // ''); |
22
|
398
|
|
100
|
|
|
1006
|
my $value = $self->value // ''; |
23
|
398
|
100
|
|
|
|
4193
|
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 |