File Coverage

inc/My/Module/Build.pm
Criterion Covered Total %
statement 19 66 28.7
branch 0 12 0.0
condition n/a
subroutine 6 12 50.0
pod 0 7 0.0
total 25 97 25.7


line stmt bran cond sub pod time code
1             package My::Module::Build;
2              
3 1     1   8 use strict;
  1         3  
  1         56  
4 1     1   7 use warnings;
  1         14  
  1         96  
5              
6 1     1   757 use Module::Build;
  1         122784  
  1         81  
7             our @ISA = qw{ Module::Build };
8              
9             our $VERSION = '0.048';
10              
11 1     1   10 use Carp;
  1         2  
  1         103  
12              
13             # use lib 'inc'; # Already done because this module is running.
14 1     1   560 use My::Module::Recommend;
  1         4  
  1         922  
15              
16             sub ACTION_authortest {
17             ## my ( $self, @args ) = @_; # Arguments unused
18 0     0 0 0 my ( $self ) = @_;
19              
20 0         0 $self->depends_on( qw{
21             functional_test
22             entities_test
23             optionals_test
24             structural_test
25             } );
26              
27 0         0 return;
28             }
29              
30             sub ACTION_functional_test {
31 0     0 0 0 my ( $self ) = @_;
32              
33 0         0 local $ENV{AUTHOR_TESTING} = 1;
34              
35 0         0 $self->my_depends_on();
36              
37 0         0 print <<'EOD';
38              
39             functional_test
40             AUTHOR_TESTING=1
41             EOD
42              
43             # Not depends_on(), because that is idempotent. But we really do
44             # want to run 'test' more than once if we do more than one of the
45             # *_test actions.
46 0         0 $self->dispatch( 'test' );
47              
48 0         0 return;
49             }
50              
51             sub ACTION_entities_test {
52 0     0 0 0 my ( $self ) = @_;
53              
54 0         0 my $optionals = join ',', qw{ XML::DoubleEncodedEntities };
55 0         0 local $ENV{AUTHOR_TESTING} = 1;
56 0         0 local $ENV{PERL5OPT} = "-MTest::Without::Module=$optionals";
57              
58 0         0 $self->my_depends_on();
59              
60 0         0 print <<"EOD";
61              
62             entities_test
63             AUTHOR_TESTING=1
64             PERL5OPT=-MTest::Without::Module=$optionals
65             EOD
66              
67             # Not depends_on(), because that is idempotent. But we really do
68             # want to run 'test' more than once if we do more than one of the
69             # *_test actions.
70 0         0 $self->dispatch( 'test' );
71              
72 0         0 return;
73             }
74              
75             sub ACTION_optionals_test {
76 0     0 0 0 my ( $self ) = @_;
77              
78 0         0 my $optionals = join ',', My::Module::Recommend->optionals();
79 0         0 local $ENV{AUTHOR_TESTING} = 1;
80 0         0 local $ENV{PERL5OPT} = "-MTest::Without::Module=$optionals";
81              
82 0         0 $self->my_depends_on();
83              
84 0         0 print <<"EOD";
85              
86             optionals_test
87             AUTHOR_TESTING=1
88             PERL5OPT=-MTest::Without::Module=$optionals
89             EOD
90              
91             # Not depends_on(), because that is idempotent. But we really do
92             # want to run 'test' more than once if we do more than one of the
93             # *_test actions.
94 0         0 $self->dispatch( 'test' );
95              
96 0         0 return;
97             }
98              
99             sub ACTION_structural_test {
100 0     0 0 0 my ( $self ) = @_;
101              
102 0         0 local $ENV{AUTHOR_TESTING} = 1;
103              
104 0         0 $self->my_depends_on();
105              
106 0         0 print <<'EOD';
107              
108             structural_test
109             AUTHOR_TESTING=1
110             EOD
111              
112 0         0 my $structural_test_files = 'xt/author';
113 0 0       0 if ( $self->can( 'args' ) ) {
114 0         0 my @arg = $self->args();
115 0         0 for ( my $inx = 0; $inx < $#arg; $inx += 2 ) {
116 0 0       0 $arg[$inx] =~ m/ \A structural[-_]test[-_]files \z /smx
117             or next;
118 0         0 $structural_test_files = $arg[ $inx + 1 ];
119 0         0 last;
120             }
121             }
122 0         0 $self->test_files( $structural_test_files );
123              
124             # Not depends_on(), because that is idempotent. But we really do
125             # want to run 'test' more than once if we do more than one of the
126             # *_test actions.
127 0         0 $self->dispatch( 'test' );
128              
129 0         0 return;
130             }
131              
132             sub my_depends_on {
133 0     0 0 0 my ( $self ) = @_;
134 0         0 my @depends_on;
135 0 0       0 -d 'blib'
136             or push @depends_on, 'build';
137 0 0       0 -e 'META.json'
138             or push @depends_on, 'distmeta';
139             @depends_on
140 0 0       0 and $self->depends_on( @depends_on );
141 0         0 return;
142             }
143              
144             sub harness_switches {
145 1     1 0 45229 my ( $self ) = @_;
146 1         14 my @res = $self->SUPER::harness_switches();
147 1         24 foreach ( @res ) {
148 0 0       0 '-MDevel::Cover' eq $_
149             or next;
150 0         0 $_ .= '=-db,cover_db,-ignore,inc/';
151             }
152 1         3 return @res;
153             }
154              
155             1;
156              
157             __END__