| 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
| |||||||||||||||||||||||||||||
| 16 | 1 | return $path; | |||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 5 | my $dir = IO::Dir->new($path); | |||||||||||||||||||||||||||
| 20 | 5 | ▶ | if(!$dir) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
Condition100%3/3
$name eq "." or $name eq ".."
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 ".."
| |||||||||||||||||||||||||||||
| 28 | 5 | my $full_name = "$path/$name"; | |||||||||||||||||||||||||||
| 29 | 5 | ▶ | if(-f $full_name) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||