File Coverage

inc/My/Module/Build.pm
Criterion Covered Total %
statement 15 52 28.8
branch 0 10 0.0
condition n/a
subroutine 5 10 50.0
pod 0 5 0.0
total 20 77 25.9


line stmt bran cond sub pod time code
1             package My::Module::Build;
2              
3 1     1   5 use strict;
  1         2  
  1         35  
4 1     1   3 use warnings;
  1         4  
  1         54  
5              
6 1     1   656 use Module::Build;
  1         78378  
  1         39  
7             our @ISA = qw{ Module::Build };
8              
9 1     1   6 use Carp;
  1         0  
  1         90  
10             # use lib 'inc'; # Already done because this module is running.
11 1     1   394 use My::Module::Recommend;
  1         2  
  1         364  
12              
13             sub ACTION_authortest {
14             ## my ( $self, @args ) = @_; # Arguments unused
15 0     0 0   my ( $self ) = @_;
16              
17 0           $self->depends_on( qw{ functional_test optionals_test structural_test } );
18              
19 0           return;
20             }
21              
22             sub ACTION_functional_test {
23 0     0 0   my ( $self ) = @_;
24              
25 0           local $ENV{AUTHOR_TESTING} = 1;
26              
27 0           $self->my_depends_on();
28              
29 0           print <<'EOD';
30              
31             functional_test
32             AUTHOR_TESTING=1
33             EOD
34              
35             # Not depends_on(), because that is idempotent. But we really do
36             # want to run 'test' more than once if we do more than one of the
37             # *_test actions.
38 0           $self->dispatch( 'test' );
39              
40 0           return;
41             }
42              
43             sub ACTION_optionals_test {
44 0     0 0   my ( $self ) = @_;
45              
46 0           my $optionals = join ',', My::Module::Recommend->optionals();
47 0           local $ENV{AUTHOR_TESTING} = 1;
48 0           local $ENV{PERL5OPT} = "-MTest::Without::Module=$optionals";
49              
50 0           $self->my_depends_on();
51              
52 0           print <<"EOD";
53              
54             optionals_test
55             AUTHOR_TESTING=1
56             PERL5OPT=-MTest::Without::Module=$optionals
57             EOD
58              
59             # Not depends_on(), because that is idempotent. But we really do
60             # want to run 'test' more than once if we do more than one of the
61             # *_test actions.
62 0           $self->dispatch( 'test' );
63              
64 0           return;
65             }
66              
67             sub ACTION_structural_test {
68 0     0 0   my ( $self ) = @_;
69              
70 0           local $ENV{AUTHOR_TESTING} = 1;
71              
72 0           $self->my_depends_on();
73              
74 0           print <<'EOD';
75              
76             structural_test
77             AUTHOR_TESTING=1
78             EOD
79              
80 0           my $structural_test_files = 'xt/author';
81 0 0         if ( $self->can( 'args' ) ) {
82 0           my @arg = $self->args();
83 0           for ( my $inx = 0; $inx < $#arg; $inx += 2 ) {
84 0 0         $arg[$inx] =~ m/ \A structural[-_]test[-_]files \z /smx
85             or next;
86 0           $structural_test_files = $arg[ $inx + 1 ];
87 0           last;
88             }
89             }
90 0           $self->test_files( $structural_test_files );
91              
92             # Not depends_on(), because that is idempotent. But we really do
93             # want to run 'test' more than once if we do more than one of the
94             # *_test actions.
95 0           $self->dispatch( 'test' );
96              
97 0           return;
98             }
99              
100             sub my_depends_on {
101 0     0 0   my ( $self ) = @_;
102 0           my @depends_on;
103 0 0         -d 'blib'
104             or push @depends_on, 'build';
105 0 0         -e 'META.json'
106             or push @depends_on, 'distmeta';
107             @depends_on
108 0 0         and $self->depends_on( @depends_on );
109 0           return;
110             }
111              
112             1;
113              
114             __END__