lib/Module/Install/Admin/Find.pm

filter: Statementstmt 54.7% 29 / 53 Branchbran 14.2% 4 / 28 Conditioncond 33.3% 2 / 6 MC/DCmcdc 25.0% 1 / 4 Subroutinesub 66.6% 6 / 9 Podpod 0.0% 0 / 4 totaltotal 40.3% 42 / 104 CC 20 SCAR 36.0
CC
20
Cov
40%
find_files
72.0
find_in_inc
56.0
glob_in_inc
7.1
CRAP 36.6
« lib/Module/Install/Makefile.pm ↑ Summary lib/Module/Install/Can.pm »
1 package Module::Install::Admin::Find;
2  
3 46 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 46 ▶use File::Find ();
Subroutine BEGIN: called CC=1 SCAR=0.0
5 46 ▶use Module::Install::Base ();
Subroutine BEGIN: called CC=1 SCAR=0.0
6 46 ▶use vars qw{$VERSION @ISA};
Subroutine BEGIN: called CC=1 SCAR=0.0
7 46 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
8 46 $VERSION = '1.21';
9 46 @ISA = qw(Module::Install::Base);
10 }
11  
12 0 ▶sub find_extensions {
Subroutine find_extensions: not called CC=1 SCAR=6.9
Pod undocumented
13 0 my $self = shift;
14 0 $self->_top->find_extensions(@_);
15 }
16  
17 0 ▶sub find_in_inc {
Subroutine find_in_inc: not called CC=7 SCAR=40.3
Pod undocumented
18 0 my ($self, $pkg) = @_;
19  
20 0 ▶ unless ($pkg =~ /\.pm$/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($pkg =~ /\.pm$/) 0 0 0
21 0 $pkg =~ s!::!/!g;
22 0 $pkg = "$pkg.pm";
23 }
24  
25 0 my @found;
26 0 foreach my $inc (@INC) {
27 0 ▶ next if $inc eq $self->_top->{prefix} or ref($inc);
Branch: 1 branch
BranchTrueFalseTotal
if $inc eq $self->_top->{"prefix"} or ref $inc 0 0 0
Condition0%0/3
$inc eq $self->_top->{"prefix"} or ref $inc
l!l&&r!l&&!r
000
MC/DC0%0/2
$inc eq $self->_top->{"prefix"} or ref $inc
$inc eq $self->_top->{"prefix"} ref $inc
Truth table0%0/3
A or B
A= $inc eq $self->_top->{"prefix"}B= ref $inc
ABresult
1X1
011
000
28 0 ▶ push @found, "$inc/$pkg" if -f "$inc/$pkg";
Branch: 1 branch
BranchTrueFalseTotal
if -f "$inc/$pkg" 0 0 0
29 }
30  
31 0 ▶ wantarray ? @found : $found[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
32 }
33  
34 1 ▶sub glob_in_inc {
Subroutine glob_in_inc: called CC=7 SCAR=19.6
Pod undocumented
35 1 my ($self, $pkg) = @_;
36  
37 1 ▶ unless ($pkg =~ /\.pm$/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($pkg =~ /\.pm$/) 1 0 1
38 1 $pkg =~ s!::!/!g;
39 1 $pkg = "$pkg.pm";
40 }
41  
42 1 my @found;
43 1 foreach my $inc (@INC) {
44 10 ▶ next if $inc eq $self->_top->{prefix} or ref($inc);
Branch: 1 branch
BranchTrueFalseTotal
if $inc eq $self->_top->{"prefix"} or ref $inc 1 9 10
Condition66%2/3
$inc eq $self->_top->{"prefix"} or ref $inc
l!l&&r!l&&!r
109
MC/DC50%1/2
$inc eq $self->_top->{"prefix"} or ref $inc
$inc eq $self->_top->{"prefix"} ref $inc
Truth table66%2/3
A or B
A= $inc eq $self->_top->{"prefix"}B= ref $inc
ABresult
1X1
011
000
45 push @found, [ do {
46 1 my $p = $_;
47 1 $p =~ s!^\Q$inc\E/!!;
48 1 $p =~ s!/!::!g;
49 1 $p =~ s!\.pm\Z!!gi;
50 1 $p
51 9 }, $_ ] for grep -e, glob("$inc/$pkg");
52 }
53  
54 1 ▶ wantarray ? @found : $found[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 1 0 1
55 }
56  
57 0 ▶sub find_files {
Subroutine find_files: not called CC=8 SCAR=42.8
Pod undocumented
58 0 my ($self, $file, $path) = @_;
59 0 ▶ $path = '' if not defined $path;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $path 0 0 0
60 0 ▶ $file = "$path/$file" if length($path);
Branch: 1 branch
BranchTrueFalseTotal
if length $path 0 0 0
61 0 ▶ if (-f $file) {
Branch: 2 branches
BranchTrueFalseTotal
if (-f $file) { } 0 0 0
elsif (-d $file) { } 0 0 0
62 0 return ($file);
63 }
64 elsif (-d $file) {
65 0 my @files = ();
66 0 local *DIR;
67 0 ▶ opendir(DIR, $file) or die "Can't opendir $file";
Branch: 1 branch
BranchTrueFalseTotal
opendir DIR, $file or die "Can't opendir $file" 0 0 0
68 0 ▶ while (my $new_file = readdir(DIR)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $new_file = readdir DIR)) 0 0 0
69 0 ▶ next if $new_file =~ /^(\.|\.\.)$/;
Branch: 1 branch
BranchTrueFalseTotal
if $new_file =~ /^(\.|\.\.)$/ 0 0 0
70 0 push @files, $self->find_files($new_file, $file);
71 }
72 0 return @files;
73 }
74 0 return ();
75 }
76  
77 46 1;
« lib/Module/Install/Makefile.pm ↑ Summary lib/Module/Install/Can.pm »