File Coverage

inc/My/Build.pm
Criterion Covered Total %
statement 16 25 64.0
branch 1 6 16.6
condition 2 6 33.3
subroutine 5 5 100.0
pod 0 1 0.0
total 24 43 55.8


line stmt bran cond sub pod time code
1             package My::Build;
2              
3 1     1   5 use strict;
  1         1  
  1         49  
4 1     1   4 use warnings;
  1         1  
  1         68  
5 1     1   4 use base qw(Module::Build);
  1         9  
  1         712  
6 1     1   78963 use File::Spec ();
  1         1  
  1         199  
7              
8             sub ACTION_code {
9 1     1 0 178 my( $self ) = @_;
10              
11             # Generate the parser using yapp, unless Grammar.pm is read-only
12             # (as it happens during a CPAN installation)
13 1         12 my $grammar_module = File::Spec->catfile(qw(lib ExtUtils XSpp Grammar.pm));
14 1 50 33     57 if( ( !-e $grammar_module || -w $grammar_module ) &&
      33        
15             !$self->up_to_date( [ 'XSP.yp' ],
16             [ $grammar_module ] ) ) {
17 0         0 $self->do_system( 'yapp', '-v', '-m', 'ExtUtils::XSpp::Grammar', '-s',
18             '-o', $grammar_module, 'XSP.yp' );
19              
20             # Replace the copy Parse::Yapp::Driver with a package in
21             # our own namespace hierarchy
22 0 0       0 open my $fh, '+<', $grammar_module
23             or die "Could not open file '$grammar_module' for rw: $!";
24             my @code = map {
25 0         0 s{(?
  0         0  
26             {ExtUtils::XSpp::Grammar::YappDriver}gx;
27 0         0 $_
28             } <$fh>;
29 0         0 seek $fh, 0, 0;
30 0         0 truncate $fh, 0;
31 0         0 print $fh @code;
32 0 0       0 close $fh or die "Updating grammar module failed: $!";
33             }
34              
35 1         58 $self->SUPER::ACTION_code;
36             }
37              
38             1;