inc/Module/Install/Can.pm

filter: Statementstmt 42.5% 23 / 54 Branchbran 6.2% 1 / 16 Conditioncond 0.0% 0 / 14 MC/DCmcdc 0.0% 0 / 9 Subroutinesub 63.6% 7 / 11 Podpod 100% 3 / 3 totaltotal 31.7% 34 / 107 CC 13 SCAR 28.8
CC
13
Cov
29%
can_run
42.0
can_cc
20.0
can_use
12.0
CRAP 17.9
« lib/Egg/Helper/Util/Base.pm ↑ Summary inc/Module/Install/WriteAll.pm »
1 #line 1
2 package Module::Install::Can;
3 1 ▶ 
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Module::Install::Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 use Config ();
7 ### This adds a 5.005 Perl version dependency.
8 1 ▶### This is a bug and will be fixed.
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use File::Spec ();
Subroutine BEGIN: called CC=1 SCAR=0.0
10 use ExtUtils::MakeMaker ();
11 1 ▶ 
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use vars qw{$VERSION $ISCORE @ISA};
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 BEGIN {
14 1 $VERSION = '0.71';
15 1 $ISCORE = 1;
16 @ISA = qw{Module::Install::Base};
17 }
18  
19 # check if we can load some module
20 0 ▶### Upgrade this to not have to load the module if possible
Subroutine can_use: not called CC=3 SCAR=24.8
Pod documented
21 0 sub can_use {
22 0 my ($self, $mod, $ver) = @_;
23 0 ▶ $mod =~ s{::|\\}{/}g;
Branch: 1 branch
BranchTrueFalseTotal
unless $mod =~ /\.pm$/i 0 0 0
24 $mod .= '.pm' unless $mod =~ /\.pm$/i;
25 0  
26 0 my $pkg = $mod;
27 0 $pkg =~ s{/}{::}g;
28 $pkg =~ s{\.pm$}{}i;
29 0  
30 0 ▶ local $@;
Condition0%0/2
$ver || 0
l!l
00
MC/DC0%0/1
$ver || 0
$ver
Truth table0%0/2
A
A= $ver
Aresult
11
00
31 eval { require $mod; $pkg->VERSION($ver || 0); 1 };
32 }
33  
34 0 ▶# check if we can run some command
Subroutine can_run: not called CC=6 SCAR=37.4
Pod documented
35 0 sub can_run {
36 my ($self, $cmd) = @_;
37 0  
38 0 ▶ my $_cmd = $cmd;
Branch: 1 branch
BranchTrueFalseTotal
if -x $_cmd or $_cmd = "MM"->maybe_command($_cmd) 0 0 0
Condition0%0/3
-x $_cmd or $_cmd = "MM"->maybe_command($_cmd)
l!l&&r!l&&!r
000
MC/DC0%0/2
-x $_cmd or $_cmd = "MM"->maybe_command($_cmd)
-x $_cmd $_cmd = "MM"->maybe_command($_cmd)
Truth table0%0/3
A or B
A= -x $_cmdB= $_cmd = "MM"->maybe_command($_cmd)
ABresult
1X1
011
000
39 return $_cmd if (-x $_cmd or $_cmd = MM->maybe_command($_cmd));
40 0  
41 0 for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
42 0 ▶ my $abs = File::Spec->catfile($dir, $_[1]);
Branch: 1 branch
BranchTrueFalseTotal
if -x $abs or $abs = "MM"->maybe_command($abs) 0 0 0
Condition0%0/3
-x $abs or $abs = "MM"->maybe_command($abs)
l!l&&r!l&&!r
000
MC/DC0%0/2
-x $abs or $abs = "MM"->maybe_command($abs)
-x $abs $abs = "MM"->maybe_command($abs)
Truth table0%0/3
A or B
A= -x $absB= $abs = "MM"->maybe_command($abs)
ABresult
1X1
011
000
43 return $abs if (-x $abs or $abs = MM->maybe_command($abs));
44 }
45 0  
46 return;
47 }
48  
49 0 ▶# can we locate a (the) C compiler
Subroutine can_cc: not called CC=4 SCAR=30.0
Pod documented
50 0 sub can_cc {
51 0 ▶ my $self = shift;
Branch: 1 branch
BranchTrueFalseTotal
my @chunks = split(/ /, $Config::Config{"cc"}, 0) or return 0 0 0
52 my @chunks = split(/ /, $Config::Config{cc}) or return;
53  
54 0 ▶ # $Config{cc} may contain args; try to find out the program part
Branch: 1 branch
BranchTrueFalseTotal
if (@chunks) 0 0 0
55 0 ▶ while (@chunks) {
Condition0%0/3
$self->can_run(join($", @chunks)) || (pop @chunks, next)
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->can_run(join($", @chunks)) || (pop @chunks, next)
$self->can_run(join($", @chunks)) (pop @chunks, next)
Truth table0%0/3
A || B
A= $self->can_run(join($", @chunks))B= (pop @chunks, next)
ABresult
1X1
011
000
56 return $self->can_run("@chunks") || (pop(@chunks), next);
57 }
58 0  
59 return;
60 }
61  
62 1 ▶# Fix Cygwin bug on maybe_command();
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq "cygwin") 0 1 1
63 0 if ( $^O eq 'cygwin' ) {
64 0 require ExtUtils::MM_Cygwin;
65 0 ▶ require ExtUtils::MM_Win32;
Branch: 1 branch
BranchTrueFalseTotal
unless (defined &ExtUtils::MM_Cygwin::maybe_command) 0 0 0
66 0 ▶ if ( ! defined(&ExtUtils::MM_Cygwin::maybe_command) ) {
Subroutine __ANON__: not called CC=3 SCAR=24.8
67 0 *ExtUtils::MM_Cygwin::maybe_command = sub {
68 0 ▶ my ($self, $file) = @_;
Branch: 1 branch
BranchTrueFalseTotal
if ($file =~ m[^/cygdrive/]i and 'ExtUtils::MM_Win32'->can('maybe_command')) { } 0 0 0
Condition0%0/3
$file =~ m[^/cygdrive/]i and "ExtUtils::MM_Win32"->can("maybe_command")
!ll&&!rl&&r
000
MC/DC0%0/2
$file =~ m[^/cygdrive/]i and "ExtUtils::MM_Win32"->can("maybe_command")
$file =~ m[^/cygdrive/]i "ExtUtils::MM_Win32"->can("maybe_command")
Truth table0%0/3
A and B
A= $file =~ m[^/cygdrive/]iB= "ExtUtils::MM_Win32"->can("maybe_command")
ABresult
0X0
100
111
69 0 if ($file =~ m{^/cygdrive/}i and ExtUtils::MM_Win32->can('maybe_command')) {
70 ExtUtils::MM_Win32->maybe_command($file);
71 0 } else {
72 ExtUtils::MM_Unix->maybe_command($file);
73 }
74 0 }
75 }
76 }
77 1  
78 1;
79  
80 __END__
« lib/Egg/Helper/Util/Base.pm ↑ Summary inc/Module/Install/WriteAll.pm »