line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::Body::Builder::UrlEncoded; |
2
|
1
|
|
|
1
|
|
93985
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
65
|
|
3
|
1
|
|
|
1
|
|
10
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
49
|
|
4
|
1
|
|
|
1
|
|
8
|
use utf8; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
9
|
|
5
|
1
|
|
|
1
|
|
64
|
use 5.008_005; |
|
1
|
|
|
|
|
4
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
6
|
use Carp (); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
32
|
|
8
|
1
|
|
|
1
|
|
33480
|
use URI; |
|
1
|
|
|
|
|
9843
|
|
|
1
|
|
|
|
|
1740
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
4
|
|
|
4
|
1
|
6317
|
my $class = shift; |
12
|
4
|
50
|
|
|
|
16
|
my %args = @_==1 ? %{$_[0]} : @_; |
|
0
|
|
|
|
|
0
|
|
13
|
4
|
|
|
|
|
7
|
my $content = delete $args{content}; |
14
|
4
|
|
|
|
|
11
|
my $self = bless { |
15
|
|
|
|
|
|
|
%args |
16
|
|
|
|
|
|
|
}, $class; |
17
|
4
|
100
|
|
|
|
12
|
if ($content) { |
18
|
1
|
|
|
|
|
2
|
for my $key (keys %{$content}) { |
|
1
|
|
|
|
|
4
|
|
19
|
3
|
100
|
|
|
|
13
|
for my $value (ref $content->{$key} ? @{$content->{$key}} : $content->{$key}) { |
|
1
|
|
|
|
|
2
|
|
20
|
4
|
|
|
|
|
8
|
$self->add_content($key => $value); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
} |
24
|
4
|
|
|
|
|
12
|
return $self; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub add_content { |
28
|
8
|
|
|
8
|
1
|
26
|
my ($self, $name, $value) = @_; |
29
|
8
|
|
|
|
|
10
|
push @{$self->{content}}, $name, $value; |
|
8
|
|
|
|
|
31
|
|
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub content_type { |
33
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
34
|
0
|
|
|
|
|
0
|
return 'application/x-www-form-urlencoded'; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub add_file { |
38
|
1
|
|
|
1
|
0
|
192
|
Carp::croak "You cannot add file with application/x-www-form-urlencoded."; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub as_string { |
42
|
7
|
|
|
7
|
1
|
20
|
my ($self) = @_; |
43
|
|
|
|
|
|
|
|
44
|
7
|
|
|
|
|
29
|
my $uri = URI->new('http:'); |
45
|
7
|
|
|
|
|
8546
|
$uri->query_form($self->{content}); |
46
|
7
|
|
|
|
|
685
|
my $content = $uri->query; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# HTML/4.01 says that line breaks are represented as "CR LF" pairs (i.e., `%0D%0A') |
49
|
7
|
50
|
|
|
|
72
|
$content =~ s/(?
|
50
|
7
|
|
|
|
|
53
|
$content; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
__END__ |