line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FormValidator::Lite::Upload; |
2
|
30
|
|
|
30
|
|
100
|
use strict; |
|
30
|
|
|
|
|
32
|
|
|
30
|
|
|
|
|
689
|
|
3
|
30
|
|
|
30
|
|
94
|
use warnings; |
|
30
|
|
|
|
|
33
|
|
|
30
|
|
|
|
|
514
|
|
4
|
30
|
|
|
30
|
|
85
|
use Carp (); |
|
30
|
|
|
|
|
31
|
|
|
30
|
|
|
|
|
414
|
|
5
|
30
|
|
|
30
|
|
1304
|
use Scalar::Util qw/blessed/; |
|
30
|
|
|
|
|
24
|
|
|
30
|
|
|
|
|
6947
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
{ |
8
|
|
|
|
|
|
|
my %cache; |
9
|
|
|
|
|
|
|
sub _load { |
10
|
11
|
|
|
11
|
|
12
|
my $pkg = shift; |
11
|
11
|
100
|
|
|
|
29
|
unless ($cache{$pkg}++) { |
12
|
3
|
|
|
3
|
|
191
|
eval "use $pkg"; ## no critic |
|
3
|
|
|
|
|
1201
|
|
|
3
|
|
|
|
|
30
|
|
|
3
|
|
|
|
|
40
|
|
13
|
3
|
50
|
|
|
|
14
|
Carp::croak($@) if $@; |
14
|
|
|
|
|
|
|
} |
15
|
11
|
|
|
|
|
30
|
$pkg; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
21
|
12
|
|
|
12
|
0
|
35125
|
my ($self, $q, $name) = @_; |
22
|
12
|
50
|
|
|
|
25
|
Carp::croak("missing parameter \$name") unless $name; |
23
|
12
|
50
|
|
|
|
65
|
Carp::croak("\$q is not a object") unless blessed $q; |
24
|
|
|
|
|
|
|
|
25
|
12
|
|
|
|
|
14
|
my $pkg = do { |
26
|
12
|
100
|
|
|
|
51
|
if ($q->isa('CGI')) { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
27
|
11
|
|
|
|
|
13
|
'CGI'; |
28
|
|
|
|
|
|
|
} elsif ($q->isa('HTTP::Engine::Request')) { |
29
|
0
|
|
|
|
|
0
|
'HTTPEngine'; |
30
|
|
|
|
|
|
|
} elsif ($q->isa('Plack::Request')) { |
31
|
0
|
|
|
|
|
0
|
'PlackRequest'; |
32
|
|
|
|
|
|
|
} else { |
33
|
1
|
50
|
|
|
|
7
|
if ($q->can('upload')){ # duck typing |
34
|
|
|
|
|
|
|
# this feature is needed by HTML::Shakan or other form validation libraries |
35
|
1
|
|
|
|
|
4
|
return $q->upload($name); # special case :) |
36
|
|
|
|
|
|
|
} else { |
37
|
0
|
|
|
|
|
0
|
die "unknown request type: $q"; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
}; |
41
|
11
|
|
|
|
|
22
|
$pkg = 'FormValidator::Lite::Upload::' . $pkg; |
42
|
|
|
|
|
|
|
|
43
|
11
|
|
|
|
|
18
|
_load($pkg)->new($q, $name); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |