VirusScan/Engine.pm

filter: Statementstmt 97.0% 33 / 34 Branchbran 80.0% 8 / 10 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 94.7% 54 / 57 CC 8 SCAR 16.2
CC
8
Cov
94%
list_files
8.1
BEGIN
1.0
BEGIN
1.0
CRAP 5.0
« VirusScan/Engine/Command.pm ↑ Summary VirusScan.pm »
1 package File::VirusScan::Engine;
2 23 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 23 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 23 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 23 ▶use IO::Dir;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 23 ▶use IO::File;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 23 ▶use base qw( Class::Accessor::Fast );
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 sub list_files
12 6 ▶{
Subroutine list_files: called CC=8 SCAR=20.9
Pod documented
13 6 my ($self, $path) = @_;
14  
15 6 ▶ if(!-d $path) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-d $path) 1 5 6
16 1 return $path;
17 }
18  
19 5 my $dir = IO::Dir->new($path);
20 5 ▶ if(!$dir) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($dir) 0 5 5
21 0 croak "Could not open directory $path: $!";
22 }
23  
24 5 my @files;
25  
26 5 for my $name ($dir->read) {
27 15 ▶ next if($name eq '.' || $name eq '..');
Branch: 1 branch
BranchTrueFalseTotal
if $name eq "." or $name eq ".." 10 5 15
Condition100%3/3
$name eq "." or $name eq ".."
l!l&&r!l&&!r
555
MC/DC100%2/2
$name eq "." or $name eq ".."
$name eq "." $name eq ".."
Truth table100%3/3
A or B
A= $name eq "."B= $name eq ".."
ABresult
1X1
011
000
28 5 my $full_name = "$path/$name";
29 5 ▶ if(-f $full_name) {
Branch: 2 branches
BranchTrueFalseTotal
if (-f $full_name) { } 3 2 5
elsif (-d _) { } 2 0 2
30 3 push @files, $full_name;
31 } elsif(-d _ ) {
32 2 push @files, $self->list_files($full_name);
33 }
34 }
35  
36 5 $dir->close;
37 5 return @files;
38 }
39  
40 23 1;
41 __END__
« VirusScan/Engine/Command.pm ↑ Summary VirusScan.pm »