line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Archive::Har::Entry::Request::QueryString; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
10
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
57
|
|
4
|
1
|
|
|
1
|
|
9
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
5
|
1
|
|
|
1
|
|
9
|
use Carp(); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
1062
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = 0.19; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
0
|
|
|
0
|
1
|
|
my ( $class, $params ) = @_; |
11
|
0
|
|
|
|
|
|
my $self = {}; |
12
|
0
|
|
|
|
|
|
bless $self, $class; |
13
|
0
|
0
|
|
|
|
|
if ( defined $params ) { |
14
|
0
|
|
|
|
|
|
$self->name( $params->{name} ); |
15
|
0
|
|
|
|
|
|
$self->value( $params->{value} ); |
16
|
0
|
0
|
|
|
|
|
if ( defined $params->{comment} ) { |
17
|
0
|
|
|
|
|
|
$self->comment( $params->{comment} ); |
18
|
|
|
|
|
|
|
} |
19
|
0
|
|
|
|
|
|
foreach my $key ( sort { $a cmp $b } keys %{$params} ) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
20
|
0
|
0
|
|
|
|
|
if ( $key =~ /^_[[:alnum:]]+$/smx ) { # private fields |
21
|
0
|
|
|
|
|
|
$self->$key( $params->{$key} ); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
} |
25
|
0
|
|
|
|
|
|
return $self; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub name { |
29
|
0
|
|
|
0
|
1
|
|
my ( $self, $new ) = @_; |
30
|
0
|
|
|
|
|
|
my $old = $self->{name}; |
31
|
0
|
0
|
|
|
|
|
if ( @_ > 1 ) { |
32
|
0
|
|
|
|
|
|
$self->{name} = $new; |
33
|
|
|
|
|
|
|
} |
34
|
0
|
|
|
|
|
|
return $old; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub value { |
38
|
0
|
|
|
0
|
1
|
|
my ( $self, $new ) = @_; |
39
|
0
|
|
|
|
|
|
my $old = $self->{value}; |
40
|
0
|
0
|
|
|
|
|
if ( @_ > 1 ) { |
41
|
0
|
|
|
|
|
|
$self->{value} = $new; |
42
|
|
|
|
|
|
|
} |
43
|
0
|
|
|
|
|
|
return $old; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub comment { |
47
|
0
|
|
|
0
|
1
|
|
my ( $self, $new ) = @_; |
48
|
0
|
|
|
|
|
|
my $old = $self->{comment}; |
49
|
0
|
0
|
|
|
|
|
if ( @_ > 1 ) { |
50
|
0
|
|
|
|
|
|
$self->{comment} = $new; |
51
|
|
|
|
|
|
|
} |
52
|
0
|
|
|
|
|
|
return $old; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub AUTOLOAD { |
56
|
0
|
|
|
0
|
|
|
my ( $self, $new ) = @_; |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
my $name = $Archive::Har::Entry::Request::QueryString::AUTOLOAD; |
59
|
0
|
|
|
|
|
|
$name =~ s/.*://smx; # strip fully-qualified portion |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
my $old; |
62
|
0
|
0
|
|
|
|
|
if ( $name =~ /^_[[:alnum:]]+$/smx ) { # private fields |
63
|
0
|
|
|
|
|
|
$old = $self->{$name}; |
64
|
0
|
0
|
|
|
|
|
if ( @_ > 1 ) { |
65
|
0
|
|
|
|
|
|
$self->{$name} = $new; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
else { |
69
|
0
|
|
|
|
|
|
Carp::croak( |
70
|
|
|
|
|
|
|
"$name is not specified in the HAR 1.2 spec and does not start with an underscore" |
71
|
|
|
|
|
|
|
); |
72
|
|
|
|
|
|
|
} |
73
|
0
|
|
|
|
|
|
return $old; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub TO_JSON { |
77
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
78
|
0
|
|
|
|
|
|
my $json = {}; |
79
|
0
|
|
|
|
|
|
$json->{name} = $self->name(); |
80
|
0
|
0
|
|
|
|
|
if ( !defined $json->{name} ) { |
81
|
0
|
|
|
|
|
|
$json->{name} = q[]; # HAR Viewer insists on this |
82
|
|
|
|
|
|
|
} |
83
|
0
|
|
|
|
|
|
$json->{value} = $self->value(); |
84
|
0
|
0
|
|
|
|
|
if ( defined $self->comment() ) { |
85
|
0
|
|
|
|
|
|
$json->{comment} = $self->comment(); |
86
|
|
|
|
|
|
|
} |
87
|
0
|
|
|
|
|
|
foreach my $key ( sort { $a cmp $b } keys %{$self} ) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
88
|
0
|
0
|
|
|
|
|
next if ( !defined $self->{$key} ); |
89
|
0
|
0
|
|
|
|
|
if ( $key =~ /^_[[:alnum:]]+$/smx ) { # private fields |
90
|
0
|
|
|
|
|
|
$json->{$key} = $self->{$key}; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
} |
93
|
0
|
|
|
|
|
|
return $json; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
1; |
97
|
|
|
|
|
|
|
__DATA__ |