line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojo::Cookie::Request; |
2
|
59
|
|
|
59
|
|
61872
|
use Mojo::Base 'Mojo::Cookie'; |
|
59
|
|
|
|
|
247
|
|
|
59
|
|
|
|
|
385
|
|
3
|
|
|
|
|
|
|
|
4
|
59
|
|
|
59
|
|
573
|
use Mojo::Util qw(quote split_header); |
|
59
|
|
|
|
|
157
|
|
|
59
|
|
|
|
|
21181
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub parse { |
7
|
193
|
|
|
193
|
1
|
30539
|
my ($self, $str) = @_; |
8
|
|
|
|
|
|
|
|
9
|
193
|
|
|
|
|
325
|
my @cookies; |
10
|
193
|
|
100
|
|
|
324
|
my @pairs = map {@$_} @{split_header $str // ''}; |
|
74
|
|
|
|
|
369
|
|
|
193
|
|
|
|
|
951
|
|
11
|
193
|
|
|
|
|
888
|
while (my ($name, $value) = splice @pairs, 0, 2) { |
12
|
171
|
100
|
|
|
|
513
|
next if $name =~ /^\$/; |
13
|
148
|
|
50
|
|
|
528
|
push @cookies, $self->new(name => $name, value => $value // ''); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
193
|
|
|
|
|
1042
|
return \@cookies; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub to_string { |
20
|
399
|
|
|
399
|
1
|
709
|
my $self = shift; |
21
|
399
|
100
|
100
|
|
|
1211
|
return '' unless length(my $name = $self->name // ''); |
22
|
398
|
|
100
|
|
|
957
|
my $value = $self->value // ''; |
23
|
398
|
100
|
|
|
|
4065
|
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 |