lib/ExtUtils/MM.pm

filter: Statementstmt 87.2% 41 / 47 Branchbran 50.0% 8 / 16 Conditioncond 16.6% 1 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 60.0% 3 / 5 Podpod n/a totaltotal 67.9% 53 / 78 CC 4 SCAR 16.8
CC
4
Cov
72%
_is_win95
12.0
_assert
2.0
BEGIN
1.0
CRAP 5.4
« lib/ExtUtils/Command.pm ↑ Summary lib/ExtUtils/MM_QNX.pm »
1 package ExtUtils::MM;
2  
3 50 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 50 ▶use ExtUtils::MakeMaker::Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 50 our $VERSION = '7.13_01';
7 50 $VERSION = eval $VERSION;
8  
9 50 require ExtUtils::Liblist;
10 50 require ExtUtils::MakeMaker;
11 50 our @ISA = qw(ExtUtils::Liblist ExtUtils::MakeMaker);
12  
13 =head1 NAME
14  
15 ExtUtils::MM - OS adjusted ExtUtils::MakeMaker subclass
16  
17 =head1 SYNOPSIS
18  
19 require ExtUtils::MM;
20 my $mm = MM->new(...);
21  
22 =head1 DESCRIPTION
23  
24 B<FOR INTERNAL USE ONLY>
25  
26 ExtUtils::MM is a subclass of ExtUtils::MakeMaker which automatically
27 chooses the appropriate OS specific subclass for you
28 (ie. ExtUils::MM_Unix, etc...).
29  
30 It also provides a convenient alias via the MM class (I didn't want
31 MakeMaker modules outside of ExtUtils/).
32  
33 This class might turn out to be a temporary solution, but MM won't go
34 away.
35  
36 =cut
37  
38 {
39 # Convenient alias.
40 package MM;
41 50 our @ISA = qw(ExtUtils::MM);
42 ▶ sub DESTROY {}
Subroutine DESTROY: not called CC=1 SCAR=0.0
43 }
44  
45 50 sub _is_win95 {
46 # miniperl might not have the Win32 functions available and we need
47 # to run in miniperl.
48 0 ▶ my $have_win32 = eval { require Win32 };
Subroutine _is_win95: not called CC=3 SCAR=24.8
49 return $have_win32 && defined &Win32::IsWin95 ? Win32::IsWin95()
50 0 ▶ : ! defined $ENV{SYSTEMROOT};
Branch: 1 branch
BranchTrueFalseTotal
$have_win32 && defined &Win32::IsWin95 ? : 0 0 0
Condition0%0/3
$have_win32 and defined &Win32::IsWin95
!ll&&!rl&&r
000
MC/DC0%0/2
$have_win32 and defined &Win32::IsWin95
$have_win32 defined &Win32::IsWin95
Truth table0%0/3
A and B
A= $have_win32B= defined &Win32::IsWin95
ABresult
0X0
100
111
51 }
52  
53 50 my %Is = ();
54 50 $Is{VMS} = $^O eq 'VMS';
55 50 $Is{OS2} = $^O eq 'os2';
56 50 $Is{MacOS} = $^O eq 'MacOS';
57 50 ▶if( $^O eq 'MSWin32' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq "MSWin32") 0 50 50
58 0 ▶ _is_win95() ? $Is{Win95} = 1 : $Is{Win32} = 1;
Branch: 1 branch
BranchTrueFalseTotal
_is_win95() ? : 0 0 0
59 }
60 50 $Is{UWIN} = $^O =~ /^uwin(-nt)?$/;
61 50 $Is{Cygwin} = $^O eq 'cygwin';
62 50 $Is{NW5} = $Config{osname} eq 'NetWare'; # intentional
63 50 ▶$Is{BeOS} = ($^O =~ /beos/i or $^O eq 'haiku');
Condition33%1/3
$^O =~ /beos/i || $^O eq 'haiku'
l!l&&r!l&&!r
0050
MC/DC0%0/2
$^O =~ /beos/i || $^O eq 'haiku'
$^O =~ /beos/i $^O eq 'haiku'
Truth table33%1/3
A || B
A= $^O =~ /beos/iB= $^O eq 'haiku'
ABresult
1X1
011
000
64 50 $Is{DOS} = $^O eq 'dos';
65 50 ▶if( $Is{NW5} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Is{"NW5"}) 0 50 50
66 0 $^O = 'NetWare';
67 0 delete $Is{Win32};
68 }
69 50 $Is{VOS} = $^O eq 'vos';
70 50 $Is{QNX} = $^O eq 'qnx';
71 50 $Is{AIX} = $^O eq 'aix';
72 50 $Is{Darwin} = $^O eq 'darwin';
73  
74 50 $Is{Unix} = !grep { $_ } values %Is;
75  
76 50 ▶map { delete $Is{$_} unless $Is{$_} } keys %Is;
Branch: 1 branch
BranchTrueFalseTotal
unless $Is{$_} 600 50 650
77 50 _assert( keys %Is == 1 );
78 50 my($OS) = keys %Is;
79  
80  
81 50 my $class = "ExtUtils::MM_$OS";
82 50 ▶eval "require $class" unless $INC{"ExtUtils/MM_$OS.pm"}; ## no critic
Branch: 1 branch
BranchTrueFalseTotal
unless $INC{"ExtUtils/MM_$OS.pm"} 49 1 50
83 50 ▶die $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 50 50
84 50 unshift @ISA, $class;
85  
86  
87 sub _assert {
88 50 ▶ my $sanity = shift;
Subroutine _assert: called CC=2 SCAR=7.1
89 50 ▶ die sprintf "Assert failed at %s line %d\n", (caller)[1,2] unless $sanity;
Branch: 1 branch
BranchTrueFalseTotal
unless $sanity 0 50 50
90 50 return;
91 }
« lib/ExtUtils/Command.pm ↑ Summary lib/ExtUtils/MM_QNX.pm »