line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Archive::Har::Entry::Cookie; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
17
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
5
|
1
|
|
|
1
|
|
1120
|
use JSON(); |
|
1
|
|
|
|
|
36292
|
|
|
1
|
|
|
|
|
59
|
|
6
|
1
|
|
|
1
|
|
13
|
use Carp(); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
1819
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = 0.19; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
0
|
|
|
0
|
0
|
|
my ( $class, $params ) = @_; |
12
|
0
|
|
|
|
|
|
my $self = {}; |
13
|
0
|
|
|
|
|
|
bless $self, $class; |
14
|
0
|
0
|
|
|
|
|
if ( defined $params ) { |
15
|
0
|
|
|
|
|
|
$self->name( $params->{name} ); |
16
|
0
|
|
|
|
|
|
$self->value( $params->{value} ); |
17
|
0
|
0
|
|
|
|
|
if ( defined $params->{path} ) { |
18
|
0
|
|
|
|
|
|
$self->path( $params->{path} ); |
19
|
|
|
|
|
|
|
} |
20
|
0
|
0
|
|
|
|
|
if ( defined $params->{domain} ) { |
21
|
0
|
|
|
|
|
|
$self->domain( $params->{domain} ); |
22
|
|
|
|
|
|
|
} |
23
|
0
|
0
|
|
|
|
|
if ( defined $params->{expires} ) { |
24
|
0
|
|
|
|
|
|
$self->expires( $params->{expires} ); |
25
|
|
|
|
|
|
|
} |
26
|
0
|
0
|
|
|
|
|
if ( defined $params->{httpOnly} ) { |
27
|
0
|
|
|
|
|
|
$self->http_only( $params->{httpOnly} ); |
28
|
|
|
|
|
|
|
} |
29
|
0
|
0
|
|
|
|
|
if ( defined $params->{secure} ) { |
30
|
0
|
|
|
|
|
|
$self->secure( $params->{secure} ); |
31
|
|
|
|
|
|
|
} |
32
|
0
|
0
|
|
|
|
|
if ( defined $params->{comment} ) { |
33
|
0
|
|
|
|
|
|
$self->comment( $params->{comment} ); |
34
|
|
|
|
|
|
|
} |
35
|
0
|
|
|
|
|
|
foreach my $key ( sort { $a cmp $b } keys %{$params} ) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
if ( $key =~ /^_[[:alnum:]]+$/smx ) { # private fields |
37
|
0
|
|
|
|
|
|
$self->$key( $params->{$key} ); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
0
|
|
|
|
|
|
return $self; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub name { |
45
|
0
|
|
|
0
|
1
|
|
my ( $self, $new ) = @_; |
46
|
0
|
|
|
|
|
|
my $old = $self->{name}; |
47
|
0
|
0
|
|
|
|
|
if ( @_ > 1 ) { |
48
|
0
|
|
|
|
|
|
$self->{name} = $new; |
49
|
|
|
|
|
|
|
} |
50
|
0
|
|
|
|
|
|
return $old; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub value { |
54
|
0
|
|
|
0
|
1
|
|
my ( $self, $new ) = @_; |
55
|
0
|
|
|
|
|
|
my $old = $self->{value}; |
56
|
0
|
0
|
|
|
|
|
if ( @_ > 1 ) { |
57
|
0
|
|
|
|
|
|
$self->{value} = $new; |
58
|
|
|
|
|
|
|
} |
59
|
0
|
|
|
|
|
|
return $old; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub path { |
63
|
0
|
|
|
0
|
1
|
|
my ( $self, $new ) = @_; |
64
|
0
|
|
|
|
|
|
my $old = $self->{path}; |
65
|
0
|
0
|
|
|
|
|
if ( @_ > 1 ) { |
66
|
0
|
|
|
|
|
|
$self->{path} = $new; |
67
|
|
|
|
|
|
|
} |
68
|
0
|
|
|
|
|
|
return $old; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub domain { |
72
|
0
|
|
|
0
|
1
|
|
my ( $self, $new ) = @_; |
73
|
0
|
|
|
|
|
|
my $old = $self->{domain}; |
74
|
0
|
0
|
|
|
|
|
if ( @_ > 1 ) { |
75
|
0
|
|
|
|
|
|
$self->{domain} = $new; |
76
|
|
|
|
|
|
|
} |
77
|
0
|
|
|
|
|
|
return $old; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub expires { |
81
|
0
|
|
|
0
|
1
|
|
my ( $self, $new ) = @_; |
82
|
0
|
|
|
|
|
|
my $old = $self->{expires}; |
83
|
0
|
0
|
|
|
|
|
if ( @_ > 1 ) { |
84
|
0
|
|
|
|
|
|
$self->{expires} = $new; |
85
|
|
|
|
|
|
|
} |
86
|
0
|
|
|
|
|
|
return $old; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub http_only { |
90
|
0
|
|
|
0
|
1
|
|
my ( $self, $new ) = @_; |
91
|
0
|
|
|
|
|
|
my $old = $self->{httpOnly}; |
92
|
0
|
0
|
|
|
|
|
if ( @_ > 1 ) { |
93
|
0
|
|
|
|
|
|
$self->{httpOnly} = $new; |
94
|
|
|
|
|
|
|
} |
95
|
0
|
0
|
|
|
|
|
if ( defined $old ) { |
96
|
0
|
0
|
|
|
|
|
return $old ? 1 : 0; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
else { |
99
|
0
|
|
|
|
|
|
return; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub secure { |
104
|
0
|
|
|
0
|
1
|
|
my ( $self, $new ) = @_; |
105
|
0
|
|
|
|
|
|
my $old = $self->{secure}; |
106
|
0
|
0
|
|
|
|
|
if ( @_ > 1 ) { |
107
|
0
|
|
|
|
|
|
$self->{secure} = $new; |
108
|
|
|
|
|
|
|
} |
109
|
0
|
0
|
|
|
|
|
if ( defined $old ) { |
110
|
0
|
0
|
|
|
|
|
return $old ? 1 : 0; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
else { |
113
|
0
|
|
|
|
|
|
return; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub comment { |
118
|
0
|
|
|
0
|
1
|
|
my ( $self, $new ) = @_; |
119
|
0
|
|
|
|
|
|
my $old = $self->{comment}; |
120
|
0
|
0
|
|
|
|
|
if ( @_ > 1 ) { |
121
|
0
|
|
|
|
|
|
$self->{comment} = $new; |
122
|
|
|
|
|
|
|
} |
123
|
0
|
|
|
|
|
|
return $old; |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub AUTOLOAD { |
127
|
0
|
|
|
0
|
|
|
my ( $self, $new ) = @_; |
128
|
|
|
|
|
|
|
|
129
|
0
|
|
|
|
|
|
my $name = $Archive::Har::Entry::Cookie::AUTOLOAD; |
130
|
0
|
|
|
|
|
|
$name =~ s/.*://smx; # strip fully-qualified portion |
131
|
|
|
|
|
|
|
|
132
|
0
|
|
|
|
|
|
my $old; |
133
|
0
|
0
|
|
|
|
|
if ( $name =~ /^_[[:alnum:]]+$/smx ) { # private fields |
134
|
0
|
|
|
|
|
|
$old = $self->{$name}; |
135
|
0
|
0
|
|
|
|
|
if ( @_ > 1 ) { |
136
|
0
|
|
|
|
|
|
$self->{$name} = $new; |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
else { |
140
|
0
|
|
|
|
|
|
Carp::croak( |
141
|
|
|
|
|
|
|
"$name is not specified in the HAR 1.2 spec and does not start with an underscore" |
142
|
|
|
|
|
|
|
); |
143
|
|
|
|
|
|
|
} |
144
|
0
|
|
|
|
|
|
return $old; |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub TO_JSON { |
148
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
149
|
0
|
|
|
|
|
|
my $json = {}; |
150
|
0
|
|
|
|
|
|
$json->{name} = $self->name(); |
151
|
0
|
|
|
|
|
|
$json->{value} = $self->value(); |
152
|
0
|
0
|
|
|
|
|
if ( defined $self->path() ) { |
153
|
0
|
|
|
|
|
|
$json->{path} = $self->path(); |
154
|
|
|
|
|
|
|
} |
155
|
0
|
0
|
|
|
|
|
if ( defined $self->domain() ) { |
156
|
0
|
|
|
|
|
|
$json->{domain} = $self->domain(); |
157
|
|
|
|
|
|
|
} |
158
|
0
|
0
|
|
|
|
|
if ( defined $self->expires() ) { |
159
|
0
|
|
|
|
|
|
$json->{expires} = $self->expires(); |
160
|
|
|
|
|
|
|
} |
161
|
0
|
0
|
|
|
|
|
if ( defined $self->http_only() ) { |
162
|
0
|
0
|
|
|
|
|
$json->{httpOnly} = $self->http_only() ? JSON::true() : JSON::false(); |
163
|
|
|
|
|
|
|
} |
164
|
0
|
0
|
|
|
|
|
if ( defined $self->secure() ) { |
165
|
0
|
0
|
|
|
|
|
$json->{secure} = $self->secure() ? JSON::true() : JSON::false(); |
166
|
|
|
|
|
|
|
} |
167
|
0
|
0
|
|
|
|
|
if ( defined $self->comment() ) { |
168
|
0
|
|
|
|
|
|
$json->{comment} = $self->comment(); |
169
|
|
|
|
|
|
|
} |
170
|
0
|
|
|
|
|
|
foreach my $key ( sort { $a cmp $b } keys %{$self} ) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
171
|
0
|
0
|
|
|
|
|
next if ( !defined $self->{$key} ); |
172
|
0
|
0
|
|
|
|
|
if ( $key =~ /^_[[:alnum:]]+$/smx ) { # private fields |
173
|
0
|
|
|
|
|
|
$json->{$key} = $self->{$key}; |
174
|
|
|
|
|
|
|
} |
175
|
|
|
|
|
|
|
} |
176
|
0
|
|
|
|
|
|
return $json; |
177
|
|
|
|
|
|
|
} |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
1; |
180
|
|
|
|
|
|
|
__END__ |