| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Archive::Har::Entry::Response::Content; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
24
|
|
|
4
|
1
|
|
|
1
|
|
3
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
13
|
|
|
5
|
1
|
|
|
1
|
|
2
|
use Carp(); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
605
|
|
|
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->size( $params->{size} ); |
|
15
|
0
|
|
|
|
|
|
$self->mime_type( $params->{mimeType} ); |
|
16
|
0
|
0
|
|
|
|
|
if ( defined $params->{compression} ) { |
|
17
|
0
|
|
|
|
|
|
$self->compression( $params->{compression} ); |
|
18
|
|
|
|
|
|
|
} |
|
19
|
0
|
0
|
|
|
|
|
if ( defined $params->{text} ) { |
|
20
|
0
|
|
|
|
|
|
$self->text( $params->{text} ); |
|
21
|
|
|
|
|
|
|
} |
|
22
|
0
|
0
|
|
|
|
|
if ( defined $params->{encoding} ) { |
|
23
|
0
|
|
|
|
|
|
$self->encoding( $params->{encoding} ); |
|
24
|
|
|
|
|
|
|
} |
|
25
|
0
|
0
|
|
|
|
|
if ( defined $params->{comment} ) { |
|
26
|
0
|
|
|
|
|
|
$self->comment( $params->{comment} ); |
|
27
|
|
|
|
|
|
|
} |
|
28
|
0
|
|
|
|
|
|
foreach my $key ( sort { $a cmp $b } keys %{$params} ) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
29
|
0
|
0
|
|
|
|
|
if ( $key =~ /^_[[:alnum:]]+$/smx ) { # private fields |
|
30
|
0
|
|
|
|
|
|
$self->$key( $params->{$key} ); |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
} |
|
34
|
0
|
|
|
|
|
|
return $self; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub mime_type { |
|
38
|
0
|
|
|
0
|
1
|
|
my ( $self, $new ) = @_; |
|
39
|
0
|
|
|
|
|
|
my $old = $self->{mimeType}; |
|
40
|
0
|
0
|
|
|
|
|
if ( @_ > 1 ) { |
|
41
|
0
|
|
|
|
|
|
$self->{mimeType} = $new; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
0
|
0
|
|
|
|
|
if ( defined $old ) { |
|
44
|
0
|
|
|
|
|
|
return $old; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
else { |
|
47
|
0
|
|
|
|
|
|
return 'text/plain'; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub size { |
|
52
|
0
|
|
|
0
|
1
|
|
my ( $self, $new ) = @_; |
|
53
|
0
|
|
|
|
|
|
my $old = $self->{size}; |
|
54
|
0
|
0
|
|
|
|
|
if ( @_ > 1 ) { |
|
55
|
0
|
|
|
|
|
|
$self->{size} = $new; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
0
|
0
|
|
|
|
|
if ( defined $old ) { |
|
58
|
0
|
|
|
|
|
|
return $old; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
else { |
|
61
|
0
|
|
|
|
|
|
return 0; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub compression { |
|
66
|
0
|
|
|
0
|
1
|
|
my ( $self, $new ) = @_; |
|
67
|
0
|
|
|
|
|
|
my $old = $self->{compression}; |
|
68
|
0
|
0
|
|
|
|
|
if ( @_ > 1 ) { |
|
69
|
0
|
|
|
|
|
|
$self->{compression} = $new; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
0
|
|
|
|
|
|
return $old; |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub text { |
|
75
|
0
|
|
|
0
|
1
|
|
my ( $self, $new ) = @_; |
|
76
|
0
|
|
|
|
|
|
my $old = $self->{text}; |
|
77
|
0
|
0
|
|
|
|
|
if ( @_ > 1 ) { |
|
78
|
0
|
|
|
|
|
|
$self->{text} = $new; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
0
|
|
|
|
|
|
return $old; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub encoding { |
|
84
|
0
|
|
|
0
|
1
|
|
my ( $self, $new ) = @_; |
|
85
|
0
|
|
|
|
|
|
my $old = $self->{encoding}; |
|
86
|
0
|
0
|
|
|
|
|
if ( @_ > 1 ) { |
|
87
|
0
|
|
|
|
|
|
$self->{encoding} = $new; |
|
88
|
|
|
|
|
|
|
} |
|
89
|
0
|
|
|
|
|
|
return $old; |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub comment { |
|
93
|
0
|
|
|
0
|
1
|
|
my ( $self, $new ) = @_; |
|
94
|
0
|
|
|
|
|
|
my $old = $self->{comment}; |
|
95
|
0
|
0
|
|
|
|
|
if ( @_ > 1 ) { |
|
96
|
0
|
|
|
|
|
|
$self->{comment} = $new; |
|
97
|
|
|
|
|
|
|
} |
|
98
|
0
|
|
|
|
|
|
return $old; |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub AUTOLOAD { |
|
102
|
0
|
|
|
0
|
|
|
my ( $self, $new ) = @_; |
|
103
|
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
my $name = $Archive::Har::Entry::Response::Content::AUTOLOAD; |
|
105
|
0
|
|
|
|
|
|
$name =~ s/.*://smx; # strip fully-qualified portion |
|
106
|
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
my $old; |
|
108
|
0
|
0
|
|
|
|
|
if ( $name =~ /^_[[:alnum:]]+$/smx ) { # private fields |
|
|
|
0
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
$old = $self->{$name}; |
|
110
|
0
|
0
|
|
|
|
|
if ( @_ > 1 ) { |
|
111
|
0
|
|
|
|
|
|
$self->{$name} = $new; |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
elsif ( $name eq 'DESTROY' ) { |
|
115
|
|
|
|
|
|
|
} |
|
116
|
|
|
|
|
|
|
else { |
|
117
|
0
|
|
|
|
|
|
Carp::croak( |
|
118
|
|
|
|
|
|
|
"$name is not specified in the HAR 1.2 spec and does not start with an underscore" |
|
119
|
|
|
|
|
|
|
); |
|
120
|
|
|
|
|
|
|
} |
|
121
|
0
|
|
|
|
|
|
return $old; |
|
122
|
|
|
|
|
|
|
} |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub TO_JSON { |
|
125
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
126
|
0
|
|
|
|
|
|
my $json = { |
|
127
|
|
|
|
|
|
|
mimeType => $self->mime_type(), |
|
128
|
|
|
|
|
|
|
size => $self->size(), |
|
129
|
|
|
|
|
|
|
}; |
|
130
|
0
|
0
|
|
|
|
|
if ( defined $self->compression() ) { |
|
131
|
0
|
|
|
|
|
|
$json->{compression} = $self->compression(); |
|
132
|
|
|
|
|
|
|
} |
|
133
|
0
|
0
|
|
|
|
|
if ( defined $self->text() ) { |
|
134
|
0
|
|
|
|
|
|
$json->{text} = $self->text(); |
|
135
|
|
|
|
|
|
|
} |
|
136
|
0
|
0
|
|
|
|
|
if ( defined $self->encoding() ) { |
|
137
|
0
|
|
|
|
|
|
$json->{encoding} = $self->encoding(); |
|
138
|
|
|
|
|
|
|
} |
|
139
|
0
|
0
|
|
|
|
|
if ( defined $self->comment() ) { |
|
140
|
0
|
|
|
|
|
|
$json->{comment} = $self->comment(); |
|
141
|
|
|
|
|
|
|
} |
|
142
|
0
|
|
|
|
|
|
foreach my $key ( sort { $a cmp $b } keys %{$self} ) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
143
|
0
|
0
|
|
|
|
|
next if ( !defined $self->{$key} ); |
|
144
|
0
|
0
|
|
|
|
|
if ( $key =~ /^_[[:alnum:]]+$/smx ) { # private fields |
|
145
|
0
|
|
|
|
|
|
$json->{$key} = $self->{$key}; |
|
146
|
|
|
|
|
|
|
} |
|
147
|
|
|
|
|
|
|
} |
|
148
|
0
|
|
|
|
|
|
return $json; |
|
149
|
|
|
|
|
|
|
} |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
1; |
|
152
|
|
|
|
|
|
|
__END__ |