File Coverage

blib/lib/Module/Build.pm
Criterion Covered Total %
statement 44 46 95.6
branch 2 4 50.0
condition n/a
subroutine 15 15 100.0
pod 0 4 0.0
total 61 69 88.4


line stmt bran cond sub pod time code
1             package Module::Build;
2              
3             # This module doesn't do much of anything itself, it inherits from the
4             # modules that do the real work. The only real thing it has to do is
5             # figure out which OS-specific module to pull in. Many of the
6             # OS-specific modules don't do anything either - most of the work is
7             # done in Module::Build::Base.
8              
9 296     296   2062200 use 5.006;
  296         1089  
10 296     296   1568 use strict;
  296         592  
  296         6129  
11 296     296   1313 use warnings;
  296         548  
  296         8063  
12 296     296   1552 use File::Spec ();
  296         549  
  296         4199  
13 296     296   1456 use File::Path ();
  296         523  
  296         4764  
14 296     296   1526 use File::Basename ();
  296         611  
  296         4361  
15 296     296   120420 use Perl::OSType ();
  296         120531  
  296         7551  
16              
17 296     296   282878 use Module::Build::Base;
  296         1279  
  296         31589  
18              
19             our @ISA = qw(Module::Build::Base);
20             our $VERSION = '0.42_35';
21             $VERSION = eval $VERSION;
22              
23             # Inserts the given module into the @ISA hierarchy between
24             # Module::Build and its immediate parent
25             sub _interpose_module {
26 296     296   810 my ($self, $mod) = @_;
27 296     296   163887 eval "use $mod";
  296         932  
  296         5479  
  296         17827  
28 296 50       1432 die $@ if $@;
29              
30 296     296   2201 no strict 'refs';
  296         641  
  296         105874  
31 296         656 my $top_class = $mod;
32 296         551 while (@{"${top_class}::ISA"}) {
  296         1659  
33 296 50       581 last if ${"${top_class}::ISA"}[0] eq $ISA[0];
  296         1654  
34 0         0 $top_class = ${"${top_class}::ISA"}[0];
  0         0  
35             }
36              
37 296         683 @{"${top_class}::ISA"} = @ISA;
  296         5016  
38 296         5643 @ISA = ($mod);
39             }
40              
41             if (grep {-e File::Spec->catfile($_, qw(Module Build Platform), $^O) . '.pm'} @INC) {
42             __PACKAGE__->_interpose_module("Module::Build::Platform::$^O");
43              
44             } elsif ( my $ostype = os_type() ) {
45             __PACKAGE__->_interpose_module("Module::Build::Platform::$ostype");
46              
47             } else {
48             warn "Unknown OS type '$^O' - using default settings\n";
49             }
50              
51 296     296 0 1535 sub os_type { return Perl::OSType::os_type() }
52              
53 113     113 0 375 sub is_vmsish { return Perl::OSType::is_os_type('VMS') }
54 13     13 0 129 sub is_windowsish { return Perl::OSType::is_os_type('Windows') }
55 3     3 0 1776 sub is_unixish { return Perl::OSType::is_os_type('Unix') }
56              
57             1;
58              
59             __END__