line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::Test::Input::URL; |
2
|
11
|
|
|
11
|
|
36
|
use strict; |
|
11
|
|
|
|
|
11
|
|
|
11
|
|
|
|
|
237
|
|
3
|
11
|
|
|
11
|
|
30
|
use warnings; |
|
11
|
|
|
|
|
11
|
|
|
11
|
|
|
|
|
227
|
|
4
|
|
|
|
|
|
|
#################################################################### |
5
|
|
|
|
|
|
|
# $Id: URL.pm 411 2011-09-26 11:19:30Z nohuhu@nohuhu.org $ |
6
|
|
|
|
|
|
|
# $Name: cgi-test_0-104_t1 $ |
7
|
|
|
|
|
|
|
#################################################################### |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# Copyright (c) 2001, Raphael Manfredi |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# You may redistribute only under the terms of the Artistic License, |
12
|
|
|
|
|
|
|
# as specified in the README file that comes with the distribution. |
13
|
|
|
|
|
|
|
# |
14
|
|
|
|
|
|
|
# |
15
|
|
|
|
|
|
|
# POST input data to be encoded with "application/x-www-form-urlencoded". |
16
|
|
|
|
|
|
|
# |
17
|
|
|
|
|
|
|
|
18
|
11
|
|
|
11
|
|
28
|
use Carp; |
|
11
|
|
|
|
|
8
|
|
|
11
|
|
|
|
|
477
|
|
19
|
|
|
|
|
|
|
|
20
|
11
|
|
|
11
|
|
39
|
use base qw(CGI::Test::Input); |
|
11
|
|
|
|
|
5
|
|
|
11
|
|
|
|
|
3870
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# |
23
|
|
|
|
|
|
|
# ->new |
24
|
|
|
|
|
|
|
# |
25
|
|
|
|
|
|
|
# Creation routine |
26
|
|
|
|
|
|
|
# |
27
|
|
|
|
|
|
|
sub new |
28
|
|
|
|
|
|
|
{ |
29
|
17
|
|
|
17
|
0
|
48
|
my $this = bless { |
30
|
|
|
|
|
|
|
mime_type => 'application/x-www-form-urlencoded' |
31
|
|
|
|
|
|
|
}, shift; |
32
|
|
|
|
|
|
|
|
33
|
17
|
|
|
|
|
72
|
$this->_init; |
34
|
|
|
|
|
|
|
|
35
|
17
|
|
|
|
|
33
|
return $this; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# DEPRECATED |
39
|
|
|
|
|
|
|
sub make |
40
|
|
|
|
|
|
|
{ # |
41
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
42
|
0
|
|
|
|
|
0
|
return $class->new(@_); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# |
46
|
|
|
|
|
|
|
# Defined interface |
47
|
|
|
|
|
|
|
# |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# |
50
|
|
|
|
|
|
|
# ->_build_data |
51
|
|
|
|
|
|
|
# |
52
|
|
|
|
|
|
|
# Rebuild data buffer from input fields. |
53
|
|
|
|
|
|
|
# |
54
|
|
|
|
|
|
|
sub _build_data |
55
|
|
|
|
|
|
|
{ |
56
|
17
|
|
|
17
|
|
13
|
my $this = shift; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# |
59
|
|
|
|
|
|
|
# Note that file uploading fields get handled as any other field, meaning |
60
|
|
|
|
|
|
|
# only the file path will be transmitted. |
61
|
|
|
|
|
|
|
# |
62
|
|
|
|
|
|
|
|
63
|
17
|
|
|
|
|
29
|
my $data = ''; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# XXX field name encoding of special chars is the same as data? |
66
|
|
|
|
|
|
|
|
67
|
17
|
|
|
|
|
23
|
foreach my $tuple (@{$this->_fields()}, @{$this->_files()}) |
|
17
|
|
|
|
|
38
|
|
|
17
|
|
|
|
|
34
|
|
68
|
|
|
|
|
|
|
{ |
69
|
257
|
|
|
|
|
422
|
my ($name, $value) = @$tuple; |
70
|
257
|
|
|
|
|
250
|
$value =~ s/([^a-zA-Z0-9_. -])/uc sprintf("%%%02x",ord($1))/eg; |
|
30
|
|
|
|
|
96
|
|
71
|
257
|
|
|
|
|
175
|
$value =~ s/ /+/g; |
72
|
257
|
|
|
|
|
172
|
$name =~ s/([^a-zA-Z0-9_.-])/uc sprintf("%%%02x",ord($1))/eg; |
|
0
|
|
|
|
|
0
|
|
73
|
257
|
100
|
|
|
|
300
|
$data .= '&' if length $data; |
74
|
257
|
|
|
|
|
275
|
$data .= $name . '=' . $value; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
17
|
|
|
|
|
30
|
return $data; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 NAME |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
CGI::Test::Input::URL - POST input encoded as application/x-www-form-urlencoded |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 SYNOPSIS |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# Inherits from CGI::Test::Input |
89
|
|
|
|
|
|
|
require CGI::Test::Input::URL; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
my $input = CGI::Test::Input::URL->new(); |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 DESCRIPTION |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This class represents the input for HTTP POST requests, encoded |
96
|
|
|
|
|
|
|
as C. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Please see L for interface details. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 AUTHORS |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
The original author is Raphael Manfredi. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Steven Hilton was long time maintainer of this module. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Current maintainer is Alexander Tokarev Ftokarev@cpan.orgE>. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 SEE ALSO |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
CGI::Test::Input(3). |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut |
113
|
|
|
|
|
|
|
|