File Coverage

blib/lib/inc/Module/Build/Functions.pm
Criterion Covered Total %
statement 7 7 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 10 10 100.0


line stmt bran cond sub pod time code
1             package inc::Module::Build::Functions;
2            
3             #
4            
5             # This module ONLY loads if the user has manually installed their own
6             # installation of Module::Build::Functions, and are some form of MI author.
7             #
8             # It runs from the installed location, and is never bundled
9             # along with the other bundled modules.
10             #
11             # So because the version of this differs from the version that will
12             # be bundled almost every time, it doesn't have it's own version and
13             # isn't part of the synchronisation-checking.
14            
15             # The load order for Module::Build::Functions is a bit magic.
16             # It goes something like this...
17             #
18             # IF ( host has Module::Build::Functions installed, creating author mode ) {
19             # 1. Build.PL calls "use inc::Module::Build::Functions"
20             # 2. $INC{inc/Module/Install.pm} set to installed version of inc::Module::Build::Functions
21             # 3. The installed version of inc::Module::Build::Functions loads
22             # 4. inc::Module::Build::Functions calls "require Module::Build::Functions"
23             # 5. The ./inc/ version of Module::Build::Functions loads
24             # } ELSE {
25             # 1. Build.PL calls "use inc::Module::Build::Functions"
26             # 2. $INC{inc/Module/Install.pm} set to ./inc/ version of Module::Build::Functions
27             # 3. The ./inc/ version of Module::Build::Functions loads
28             # }
29            
30            
31 3     3   49905 use strict;
  3         11  
  3         152  
32 3     3   16 use vars qw{$VERSION};
  3         7  
  3         229  
33             BEGIN {
34             # While this version will be overwritten when Module::Build::Functions
35             # loads, it remains so Module::Build::Functions itself can detect which
36             # version an author currently has installed.
37             # This allows it to implement any back-compatibility features
38             # it may want or need to.
39 3     3   444 $VERSION = '0.04';
40             }
41            
42             if ( -d './inc' ) {
43             my $author = $^O eq 'VMS' ? './inc/_author' : './inc/.author';
44             if ( -d $author ) {
45             $Module::Build::Functions::AUTHOR = 1;
46             require File::Path;
47             File::Path::rmtree('inc');
48             }
49             } else {
50             $Module::Build::Functions::AUTHOR = 1;
51             }
52            
53             unshift @INC, 'inc' unless $INC[0] eq 'inc';
54             require Module::Build::Functions;
55            
56             1;
57            
58             #
59            
60             __END__