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