File Coverage

blib/lib/Dist/Zilla/Role/BuildPL.pm
Criterion Covered Total %
statement 9 26 34.6
branch 0 14 0.0
condition 0 9 0.0
subroutine 3 5 60.0
pod 0 2 0.0
total 12 56 21.4


line stmt bran cond sub pod time code
1             # ABSTRACT: Common ground for Build.PL based builders
2              
3             use Moose::Role;
4 3     3   2039 with 'Dist::Zilla::Role::InstallTool',
  3         9  
  3         34  
5             'Dist::Zilla::Role::BuildRunner',
6             'Dist::Zilla::Role::TestRunner';
7              
8             use Dist::Zilla::Pragmas;
9 3     3   15853  
  3         7  
  3         26  
10             use namespace::autoclean;
11 3     3   23  
  3         6  
  3         43  
12             #pod =head1 DESCRIPTION
13             #pod
14             #pod This role is a helper for Build.PL based installers. It implements the
15             #pod L<Dist::Zilla::Plugin::BuildRunner> and L<Dist::Zilla::Plugin::TestRunner>
16             #pod roles, and requires you to implement the L<Dist::Zilla::Plugin::PrereqSource>
17             #pod and L<Dist::Zilla::Plugin::InstallTool> roles yourself.
18             #pod
19             #pod =cut
20              
21             my $self = shift;
22              
23 0     0 0   return
24             if -e 'Build' and (stat 'Build.PL')[9] <= (stat 'Build')[9];
25              
26 0 0 0       $self->log_debug("running $^X Build.PL");
27             system $^X, 'Build.PL' and die "error with Build.PL\n";
28 0            
29 0 0         $self->log_debug("running $^X Build");
30             system $^X, 'Build' and die "error running $^X Build\n";
31 0            
32 0 0         return;
33             }
34 0            
35             my ($self, $target, $arg) = @_;
36              
37             $self->build;
38 0     0 0    
39             my $job_count = $arg && exists $arg->{jobs}
40 0           ? $arg->{jobs}
41             : $self->default_jobs;
42             my $jobs = "j$job_count";
43             my $ho = "HARNESS_OPTIONS";
44 0 0 0       local $ENV{$ho} = $ENV{$ho} ? "$ENV{$ho}:$jobs" : $jobs;
45 0            
46 0           my @testing = $self->zilla->logger->get_debug || $arg->{test_verbose} ? '--verbose' : ();
47 0 0          
48             $self->log_debug('running ' . join(' ', $^X, 'Build', 'test', @testing));
49 0 0 0       system $^X, 'Build', 'test', @testing and die "error running $^X Build test\n";
50              
51 0           return;
52 0 0         }
53              
54 0           1;
55              
56              
57             =pod
58              
59             =encoding UTF-8
60              
61             =head1 NAME
62              
63             Dist::Zilla::Role::BuildPL - Common ground for Build.PL based builders
64              
65             =head1 VERSION
66              
67             version 6.028
68              
69             =head1 DESCRIPTION
70              
71             This role is a helper for Build.PL based installers. It implements the
72             L<Dist::Zilla::Plugin::BuildRunner> and L<Dist::Zilla::Plugin::TestRunner>
73             roles, and requires you to implement the L<Dist::Zilla::Plugin::PrereqSource>
74             and L<Dist::Zilla::Plugin::InstallTool> roles yourself.
75              
76             =head1 PERL VERSION
77              
78             This module should work on any version of perl still receiving updates from
79             the Perl 5 Porters. This means it should work on any version of perl released
80             in the last two to three years. (That is, if the most recently released
81             version is v5.40, then this module should work on both v5.40 and v5.38.)
82              
83             Although it may work on older versions of perl, no guarantee is made that the
84             minimum required version will not be increased. The version may be increased
85             for any reason, and there is no promise that patches will be accepted to lower
86             the minimum required perl.
87              
88             =head1 AUTHOR
89              
90             Ricardo SIGNES 😏 <cpan@semiotic.systems>
91              
92             =head1 COPYRIGHT AND LICENSE
93              
94             This software is copyright (c) 2022 by Ricardo SIGNES.
95              
96             This is free software; you can redistribute it and/or modify it under
97             the same terms as the Perl 5 programming language system itself.
98              
99             =cut