| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Net::Curl::Simple::Form; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1250
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
27
|
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
24
|
|
|
5
|
1
|
|
|
1
|
|
4
|
use Scalar::Util qw(looks_like_number); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
91
|
|
|
6
|
1
|
|
|
1
|
|
329
|
use Net::Curl::Form; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use base qw(Net::Curl::Form); |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.13'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
{ |
|
12
|
|
|
|
|
|
|
my %optcache; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub add |
|
15
|
|
|
|
|
|
|
{ |
|
16
|
|
|
|
|
|
|
my $form = shift; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my @args; |
|
19
|
|
|
|
|
|
|
while ( my ( $opt, $val ) = splice @_, 0, 2 ) { |
|
20
|
|
|
|
|
|
|
unless ( looks_like_number( $opt ) ) { |
|
21
|
|
|
|
|
|
|
# convert option name to option number |
|
22
|
|
|
|
|
|
|
unless ( exists $optcache{ $opt } ) { |
|
23
|
|
|
|
|
|
|
eval '$optcache{ $opt } = ' |
|
24
|
|
|
|
|
|
|
. "Net::Curl::Form::CURLFORM_COPY\U$opt"; |
|
25
|
|
|
|
|
|
|
eval '$optcache{ $opt } = ' |
|
26
|
|
|
|
|
|
|
. "Net::Curl::Form::CURLFORM_\U$opt" |
|
27
|
|
|
|
|
|
|
if $@; |
|
28
|
|
|
|
|
|
|
die "unrecognized literal option: $opt\n" |
|
29
|
|
|
|
|
|
|
if $@; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
$opt = $optcache{ $opt }; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
push @args, $opt, $val; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
$form->SUPER::add( @args ); |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# allow chaining |
|
40
|
|
|
|
|
|
|
return $form; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub contents |
|
45
|
|
|
|
|
|
|
{ |
|
46
|
|
|
|
|
|
|
my ( $form, $name, $contents ) = @_; |
|
47
|
|
|
|
|
|
|
$form->add( name => $name, contents => $contents ); |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub file |
|
51
|
|
|
|
|
|
|
{ |
|
52
|
|
|
|
|
|
|
my $form = shift; |
|
53
|
|
|
|
|
|
|
$form->add( name => shift, map +( file => $_ ), @_ ); |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |