File Coverage

blib/lib/PITA/Scheme/Perl5.pm
Criterion Covered Total %
statement 13 15 86.6
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 18 20 90.0


line stmt bran cond sub pod time code
1             package PITA::Scheme::Perl5;
2              
3             # Auto-sensing Perl 5 scheme.
4             # Use Makefile.PL or Build.PL as appropriate.
5              
6             # We won't know this until AFTER the extract_package method,
7             # so at the end of this method we will look for the appropriate
8             # file and rebless ourself into the class for it.
9              
10 1     1   2152 use 5.005;
  1         4  
  1         36  
11 1     1   5 use strict;
  1         3  
  1         32  
12 1     1   4 use File::Spec ();
  1         2  
  1         13  
13 1     1   797 use File::Which ();
  1         1099  
  1         18  
14 1     1   502 use PITA::Scheme::Perl ();
  0            
  0            
15              
16             use vars qw{$VERSION @ISA};
17             BEGIN {
18             $VERSION = '0.43';
19             @ISA = 'PITA::Scheme::Perl';
20             }
21              
22              
23              
24              
25              
26             #####################################################################
27             # Constructor
28              
29             sub new {
30             my $class = shift;
31             my $self = $class->SUPER::new(@_);
32             $self;
33             }
34              
35              
36              
37              
38              
39             #####################################################################
40             # PITA::Scheme Methods
41              
42             sub default_path {
43             File::Which::which('perl') || '';
44             }
45              
46             sub prepare_package {
47             my $self = shift;
48              
49             # Do the generic unpacking
50             $self->SUPER::prepare_package(@_);
51              
52             # Use the Makefile.PL in preference to Build.PL as it should be
53             # more mature than a Module::Build installer.
54             # Whichever one we call, it will end up called the same
55             # prepare_package in ::Perl. This isn't a problem, as it knows
56             # how to shortcut.
57             if ( -f $self->workarea_file('Makefile.PL') ) {
58             require PITA::Scheme::Perl5::Make;
59             bless $self, 'PITA::Scheme::Perl5::Make';
60             return $self->prepare_package;
61              
62             } elsif ( -f $self->workarea_file('Build.PL') ) {
63             require PITA::Scheme::Perl5::Make;
64             bless $self, 'PITA::Scheme::Perl5::Make';
65             return $self->prepare_package;
66              
67             }
68              
69             # Doesn't have either
70             Carp::croak("Perl5 package contains neither Makefile.PL or Build.PL");
71             }
72              
73             1;