File Coverage

blib/lib/Dist/Zilla/Plugin/MakeMaker/Runner.pm
Criterion Covered Total %
statement 31 31 100.0
branch 9 18 50.0
condition 3 9 33.3
subroutine 6 6 100.0
pod 0 2 0.0
total 49 66 74.2


line stmt bran cond sub pod time code
1             package Dist::Zilla::Plugin::MakeMaker::Runner 6.037;
2             # ABSTRACT: Test and build dists with a Makefile.PL
3              
4 13     13   88 use Moose;
  13         28  
  13         114  
5             with(
6             'Dist::Zilla::Role::BuildRunner',
7             'Dist::Zilla::Role::TestRunner',
8             );
9              
10 13     13   92159 use Dist::Zilla::Pragmas;
  13         31  
  13         600  
11              
12 13     13   392 use namespace::autoclean;
  13         37  
  13         146  
13              
14 13     13   1097 use Config;
  13         31  
  13         7160  
15              
16             has 'make_path' => (
17             isa => 'Str',
18             is => 'ro',
19             default => $Config{make} || 'make',
20             );
21              
22             sub build {
23 2     2 0 6 my $self = shift;
24              
25 2         94 my $make = $self->make_path;
26              
27 2 50       25 my $makefile = $^O eq 'VMS' ? 'Descrip.MMS' : 'Makefile';
28              
29             return
30 2 50 33     92 if -e $makefile and (stat 'Makefile.PL')[9] <= (stat $makefile)[9];
31              
32 2         26 $self->log_debug("running $^X Makefile.PL");
33 2 50       2370555 system($^X => qw(Makefile.PL INSTALLMAN1DIR=none INSTALLMAN3DIR=none)) and die "error with Makefile.PL\n";
34              
35 2         130 $self->log_debug("running $make");
36 2 50       9277995 system($make) and die "error running $make\n";
37              
38 2         87 return;
39             }
40              
41             sub test {
42 2     2 0 40 my ($self, $target, $arg) = @_;
43              
44 2         107 my $make = $self->make_path;
45 2         20 $self->build;
46              
47             my $job_count = $arg && exists $arg->{jobs}
48             ? $arg->{jobs}
49 2 50 33     352 : $self->default_jobs;
50              
51 2         28 my $jobs = "j$job_count";
52 2         17 my $ho = "HARNESS_OPTIONS";
53 2 50       116 local $ENV{$ho} = $ENV{$ho} ? "$ENV{$ho}:$jobs" : $jobs;
54              
55 2 50       145 $self->log_debug(join(' ', "running $make test", ( $self->zilla->logger->get_debug ? 'TEST_VERBOSE=1' : () )));
56             system($make, 'test',
57 2 50 33     171 ( $self->zilla->logger->get_debug || $arg->{test_verbose} ? 'TEST_VERBOSE=1' : () ),
    50          
58             ) and die "error running $make test\n";
59              
60 2         3876551 return;
61             }
62              
63             __PACKAGE__->meta->make_immutable;
64             1;
65              
66             __END__
67              
68             =pod
69              
70             =encoding UTF-8
71              
72             =head1 NAME
73              
74             Dist::Zilla::Plugin::MakeMaker::Runner - Test and build dists with a Makefile.PL
75              
76             =head1 VERSION
77              
78             version 6.037
79              
80             =head1 PERL VERSION
81              
82             This module should work on any version of perl still receiving updates from
83             the Perl 5 Porters. This means it should work on any version of perl
84             released in the last two to three years. (That is, if the most recently
85             released version is v5.40, then this module should work on both v5.40 and
86             v5.38.)
87              
88             Although it may work on older versions of perl, no guarantee is made that the
89             minimum required version will not be increased. The version may be increased
90             for any reason, and there is no promise that patches will be accepted to
91             lower the minimum required perl.
92              
93             =head1 AUTHOR
94              
95             Ricardo SIGNES 😏 <cpan@semiotic.systems>
96              
97             =head1 COPYRIGHT AND LICENSE
98              
99             This software is copyright (c) 2026 by Ricardo SIGNES.
100              
101             This is free software; you can redistribute it and/or modify it under
102             the same terms as the Perl 5 programming language system itself.
103              
104             =cut