line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Archive::Har::Entry::Request::QueryString; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
32
|
|
4
|
1
|
|
|
1
|
|
3
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
13
|
|
5
|
1
|
|
|
1
|
|
3
|
use Carp(); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
442
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.21'; |
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 |
|
|
0
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
$old = $self->{$name}; |
64
|
0
|
0
|
|
|
|
|
if ( @_ > 1 ) { |
65
|
0
|
|
|
|
|
|
$self->{$name} = $new; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
elsif ( $name eq 'DESTROY' ) { |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
else { |
71
|
0
|
|
|
|
|
|
Carp::croak( |
72
|
|
|
|
|
|
|
"$name is not specified in the HAR 1.2 spec and does not start with an underscore" |
73
|
|
|
|
|
|
|
); |
74
|
|
|
|
|
|
|
} |
75
|
0
|
|
|
|
|
|
return $old; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub TO_JSON { |
79
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
80
|
0
|
|
|
|
|
|
my $json = {}; |
81
|
0
|
|
|
|
|
|
$json->{name} = $self->name(); |
82
|
0
|
0
|
|
|
|
|
if ( !defined $json->{name} ) { |
83
|
0
|
|
|
|
|
|
$json->{name} = q[]; # HAR Viewer insists on this |
84
|
|
|
|
|
|
|
} |
85
|
0
|
|
|
|
|
|
$json->{value} = $self->value(); |
86
|
0
|
0
|
|
|
|
|
if ( defined $self->comment() ) { |
87
|
0
|
|
|
|
|
|
$json->{comment} = $self->comment(); |
88
|
|
|
|
|
|
|
} |
89
|
0
|
|
|
|
|
|
foreach my $key ( sort { $a cmp $b } keys %{$self} ) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
90
|
0
|
0
|
|
|
|
|
next if ( !defined $self->{$key} ); |
91
|
0
|
0
|
|
|
|
|
if ( $key =~ /^_[[:alnum:]]+$/smx ) { # private fields |
92
|
0
|
|
|
|
|
|
$json->{$key} = $self->{$key}; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
} |
95
|
0
|
|
|
|
|
|
return $json; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
1; |
99
|
|
|
|
|
|
|
__DATA__ |