File Coverage

inc/Local/ModuleBuild.pm
Criterion Covered Total %
statement 11 11 100.0
branch 1 2 50.0
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 16 18 88.8


line stmt bran cond sub pod time code
1             package Local::ModuleBuild;
2              
3 1     1   7 use strict;
  1         2  
  1         67  
4 1     1   6 use warnings;
  1         6  
  1         121  
5 1     1   828 BEGIN { require Module::Build; push our @ISA, 'Module::Build' }
  1         116947  
6              
7             unless(__PACKAGE__->can("cbuilder")) {
8             *cbuilder = sub { $_[0]->_cbuilder or die "no C support" };
9             }
10             unless(__PACKAGE__->can("have_c_compiler")) {
11             *have_c_compiler = sub {
12             my $cb = eval { $_[0]->cbuilder };
13             return $cb && $cb->have_compiler;
14             };
15             }
16             unless(eval { Module::Build->VERSION('0.33'); 1 }) {
17             # Older versions of Module::Build have a bug where if the
18             # cbuilder object is used at Build.PL time (which it will
19             # be for this distribution due to the logic in
20             # ->find_xs_files) then that object can be dumped to the
21             # build_params file, and then at Build time it will
22             # attempt to use the dumped blessed object without loading
23             # the ExtUtils::CBuilder class that is needed to make it
24             # work.
25             *write_config = sub {
26             delete $_[0]->{properties}->{_cbuilder};
27             return $_[0]->SUPER::write_config;
28             };
29             }
30             sub find_xs_files {
31 1     1 0 2721 my($self) = @_;
32 1 50       15 return {} unless $self->have_c_compiler;
33 1         32 return $self->SUPER::find_xs_files;
34             }
35              
36             1;