File Coverage

Makefile.PL
Criterion Covered Total %
statement 12 21 57.1
branch 0 4 0.0
condition 0 5 0.0
subroutine 4 6 66.6
pod 0 2 0.0
total 16 38 42.1


line stmt bran cond sub pod time code
1             package String::Redactable;
2 3     3   708669 use strict;
  3         5  
  3         128  
3 3     3   14 use warnings;
  3         5  
  3         211  
4              
5             =encoding utf8
6              
7             =head1 The build file for String::Redactable
8              
9             This build file is a modulino; it works as both a build script and
10             a module.
11              
12             To build the distribution, run this file normally:
13              
14             % perl Makefile.PL
15              
16             But, it's more interesting than that. You can load it with C
17             and call C to get the data structure it passes to
18             C:
19              
20             my $package = require '/path/to/Makefile.PL';
21             my $arguments = $package->arguments;
22              
23             Note that C-ing a file makes an entry in C<%INC> for exactly
24             that name. If you try to C another file with the same name,
25             even from a different path, C thinks it has already loaded
26             the file. As such, I recommend you always require the full path to the
27             file.
28              
29             The return value of the C is a package name (in this case,
30             the name of the main module. Use that to call the C method.
31              
32             Even if this distribution needs a higher version of Perl, this bit
33             only needs v5.8. You can play with the data structure with a primitive
34             Perl.
35              
36             =cut
37              
38 3     3   1583 use File::Spec::Functions qw(catfile);
  3         2621  
  3         1707  
39              
40             my $module = __PACKAGE__;
41             ( my $dist = $module ) =~ s/::/-/g;
42              
43             my $github = 'https://github.com/briandfoy/string-redactable';
44             my $main_file = catfile( 'lib', split /::/, "$module.pm" );
45              
46             my %WriteMakefile = (
47             'MIN_PERL_VERSION' => '5.020',
48              
49             'NAME' => $module,
50             'ABSTRACT_FROM' => $main_file,
51             'VERSION_FROM' => $main_file,
52             'LICENSE' => 'artistic_2',
53             'AUTHOR' => 'brian d foy ',
54              
55             'CONFIGURE_REQUIRES' => {
56             'ExtUtils::MakeMaker' => '6.64',
57             'File::Spec::Functions' => '0',
58             },
59              
60             'BUILD_REQUIRES' => {
61             },
62              
63             'TEST_REQUIRES' => {
64             'JSON' => '0',
65             'Test::More' => '1',
66             'YAML::XS' => '0',
67             },
68              
69             'PREREQ_PM' => {
70             'Carp' => '0',
71             'Encode' => '0',
72             },
73              
74             'META_MERGE' => {
75             'meta-spec' => { version => 2 },
76             resources => {
77             repository => {
78             type => 'git',
79             url => $github,
80             web => $github,
81             },
82             bugtracker => {
83             web => "$github/issues",
84             },
85             homepage => $github,
86             },
87             extra_modules => [qw()],
88             },
89              
90             'clean' => { FILES => "$dist-*" },
91             );
92              
93 0     0 0   sub arguments { \%WriteMakefile }
94              
95             do_it() unless caller;
96             sub do_it {
97 0     0 0   my $MM ='ExtUtils::MakeMaker';
98             my $MM_version =
99 0   0       eval{ "$MM " . $WriteMakefile{'CONFIGURE_REQUIRES'}{'ExtUtils::MakeMaker'} }
100             ||
101             "$MM 6.64";
102 0 0         eval "use $MM_version; 1" or die "Could not load $MM_version: $@";
103 0           eval "use Test::Manifest 1.21";
104              
105 0           my $arguments = arguments();
106 0   0       my $minimum_perl = $arguments->{MIN_PERL_VERSION} || '5.008';
107 0 0         eval "require $minimum_perl;" or die $@;
108              
109 0           WriteMakefile( %$arguments );
110             }
111              
112              
113 3     3   21 no warnings;
  3         6  
  3         260  
114             __PACKAGE__;