Nested/Validator/File.pm

filter: Statementstmt 38.4% 10 / 26 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 3 / 5 Podpod 0.0% 0 / 1 totaltotal 29.5% 13 / 44 CC 7 SCAR 28.4
CC
7
Cov
26%
_size
30.0
max_size
12.0
BEGIN
1.0
CRAP 17.2
« Nested/Filter/DateTime.pm ↑ Summary Nested/Profile/Param/Validator.pm »
1 package FormValidator::Nested::Validator::File;
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 0 ▶sub _size {
Subroutine _size: not called CC=5 SCAR=34.0
7 0 my ($req, $name) = @_;
8  
9 0 ▶ if ( ref $req eq 'CGI' ) {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $req eq 'CGI') { } 0 0 0
elsif ($req->can('upload')) { } 0 0 0
10 0 my $file = $req->param($name);
11 0 ▶ return unless $file;
Branch: 1 branch
BranchTrueFalseTotal
unless $file 0 0 0
12  
13 0 return $req->uploadInfo($file)->{'Content-Length'};
14 }
15 elsif ( $req->can('upload') ) {
16 0 my $upload = $req->upload($name);
17 0 ▶ return unless $upload;
Branch: 1 branch
BranchTrueFalseTotal
unless $upload 0 0 0
18  
19 0 return $upload->size;
20 }
21 0 return;
22 }
23  
24  
25 0 ▶sub max_size {
Subroutine max_size: not called CC=3 SCAR=24.8
Pod undocumented
26 0 my ( $value, $options, $req, $name ) = @_;
27  
28 0 my $size = _size($req, $name);
29  
30 0 ▶ if ( !defined($size) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $size) 0 0 0
31 0 return 1;
32 }
33  
34 0 ▶ if ( $size > $options->{max} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($size > $options->{"max"}) 0 0 0
35 0 return 0;
36 }
37 0 return 1;
38 }
39  
40  
41 2 1;
« Nested/Filter/DateTime.pm ↑ Summary Nested/Profile/Param/Validator.pm »