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