File Coverage

lib/Module/Build/Pluggable/PPPort.pm
Criterion Covered Total %
statement 31 31 100.0
branch 1 2 50.0
condition 2 4 50.0
subroutine 9 9 100.0
pod 0 2 0.0
total 43 48 89.5


line stmt bran cond sub pod time code
1             package Module::Build::Pluggable::PPPort;
2 3     3   66617 use strict;
  3         10  
  3         167  
3 3     3   21 use warnings;
  3         7  
  3         138  
4 3     3   89 use 5.008001;
  3         18  
  3         211  
5             our $VERSION = '0.04';
6              
7 3     3   991 use parent qw/Module::Build::Pluggable::Base/;
  3         439  
  3         205  
8             use Class::Accessor::Lite (
9 3         24 ro => [qw/version filename/],
10 3     3   28834 );
  3         203  
11              
12             sub HOOK_configure {
13 1     1 0 77605 my ($self) = @_;
14 1   50     22 my $version = $self->version || '3.19';
15 1         73 $self->build_requires('Devel::PPPort' => $version);
16 1         63 $self->configure_requires('Devel::PPPort' => $version);
17             }
18              
19             sub HOOK_build {
20 1     1 0 50 my ($self, $builder) = @_;
21 1         2827 require Devel::PPPort;
22 1   50     437 my $filename = $self->filename || 'ppport.h';
23             $self->add_before_action_modifier('build', sub {
24 1     1   131 my $self = shift;
25 1         19 $self->depends_on('ppport_h');
26 1         35 });
27             $self->add_action('ppport_h', sub {
28 1     1   27 my $self = shift;
29 1 50       25 unless (-e $filename) {
30 1         11 $self->log_info("Writing $filename\n");
31 1         314 Devel::PPPort::WriteFile($filename);
32             }
33 1         3518 $self->add_to_cleanup($filename);
34 1         319 });
35             }
36              
37              
38             1;
39             __END__