Makefile.PL

filter: Statementstmt 20.4% 18 / 88 Branchbran 1.7% 1 / 56 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 37.5% 3 / 8 Podpod n/a totaltotal 12.7% 22 / 172 CC 31 SCAR 51.0
CC
31
Cov
12%
WriteMakefile1
306.0
pod_section
90.0
update_file
30.0
CRAP 163.2
« blib/lib/HTTP/Request/FromWget.pm ↑ Summary blib/lib/HTTP/Request/CurlParameters.pm »
1 # -*- mode: perl; c-basic-offset: 4; indent-tabs-mode: nil; -*-
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use ExtUtils::MakeMaker qw(WriteMakefile);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
6 # the contents of the Makefile that is written.
7  
8 # Normalize version strings like 6.30_02 to 6.3002,
9 # so that we can do numerical comparisons on it.
10 1 my $eumm_version = $ExtUtils::MakeMaker::VERSION;
11 1 $eumm_version =~ s/_//;
12  
13 1 my $module = 'HTTP::Request::FromCurl';
14 1 (my $main_file = "lib/$module.pm" ) =~ s!::!/!g;
15 1 (my $distbase = $module) =~ s!::!-!g;
16 1 my $distlink = $distbase;
17  
18 1 my @tests = map { glob $_ } 't/*.t', 't/*/*.t';
19  
20 1 my %module = (
21 NAME => $module,
22 AUTHOR => q{Max Maischein <corion@cpan.org>},
23 VERSION_FROM => $main_file,
24 ABSTRACT_FROM => $main_file,
25 META_MERGE => {
26 "meta-spec" => { version => 2 },
27 resources => {
28 repository => {
29 web => "https://github.com/Corion/$distbase",
30 url => "git://github.com/Corion/$distbase.git",
31 type => 'git',
32 },
33 bugtracker => {
34 web => "https://github.com/Corion/$distbase/issues",
35 # mailto => 'meta-bugs@example.com',
36 },
37 license => "https://dev.perl.org/licenses/",
38 },
39 dynamic_config => 0, # we promise to keep META.* up-to-date
40 x_static_install => 1, # we are pure Perl and don't do anything fancy
41 },
42  
43 MIN_PERL_VERSION => '5.020', # I use signatures
44  
45 'LICENSE'=> 'perl',
46  
47 PL_FILES => {},
48 EXE_FILES => [glob 'script/*'],
49 BUILD_REQUIRES => {
50 'ExtUtils::MakeMaker' => 0,
51 },
52  
53 PREREQ_PM => {
54 'Carp' => 0,
55 'Getopt::Long' => '2.39', # for ->getoptionsfromarray
56 'Moo' => '2',
57 'HTTP::Request' => '6.07',
58 'HTTP::Request::Common' => '6.07',
59 'HTTP::Request::Generator' => '0.09', # earlier versions don't handle IPv6 well
60 'URI' => 0,
61 'URI::Escape' => 0,
62 'List::Util' => '1.29', # for pairmap
63 'PerlX::Maybe' => 0,
64 'MIME::Base64' => 0,
65 'JSON' => 0,
66 'File::Basename' => 0, # core anyway
67 },
68 TEST_REQUIRES => {
69 'Test2::V0' => '0',
70 'Data::Dumper' => 0,
71 'Capture::Tiny' => 0,
72 'Path::Tiny' => 0,
73 'HTTP::Tiny' => 0,
74 'WWW::Mechanize' => 0,
75 'LWP::UserAgent' => 0,
76 'IO::Socket::SSL' => 0, # for allowing -k to compile
77 #'HTTP::Cookies::Netscape' => 0, # this can't cope with the Netscape cookie files that curl writes :(
78 'HTTP::CookieJar' => 0, # this one doesn't have an adapter to save/load at all :(
79 'HTTP::CookieJar::LWP' => 0, # this one doesn't have an adapter to save/load at all :(
80 'Test::HTTP::LocalServer' => 0.67, # we want ->server_url()
81 },
82  
83 dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
84 clean => { FILES => "$distbase-*" },
85  
86 test => { TESTS => join( ' ', @tests ) },
87 );
88  
89 # This is so that we can do
90 # require 'Makefile.PL'
91 # and then call get_module_info
92  
93 1 ▶sub get_module_info { %module }
Subroutine get_module_info: called CC=1 SCAR=0.0
94  
95 1 ▶if( ! caller ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (caller) 0 1 1
96 # I should maybe use something like Shipwright...
97 0 my $mm = WriteMakefile1(get_module_info);
98 0 my $version = $mm->parse_version($main_file);
99 0 regen_README($main_file, $version);
100 0 ▶ regen_EXAMPLES() if -d 'examples';
Branch: 1 branch
BranchTrueFalseTotal
if -d "examples" 0 0 0
101 };
102  
103 1 1;
104  
105 sub WriteMakefile1 { #Written by Alexandr Ciornii, version 0.21. Added by eumm-upgrade.
106 0 ▶ my %params=@_;
Subroutine WriteMakefile1: not called CC=17 SCAR=57.2
107 0 my $eumm_version=$ExtUtils::MakeMaker::VERSION;
108 0 $eumm_version=eval $eumm_version;
109 0 ▶ die "EXTRA_META is deprecated" if exists $params{EXTRA_META};
Branch: 1 branch
BranchTrueFalseTotal
if exists $params{"EXTRA_META"} 0 0 0
110 0 ▶ die "License not specified" if not exists $params{LICENSE};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $params{"LICENSE"} 0 0 0
111 0 ▶ if ($params{BUILD_REQUIRES} and $eumm_version < 6.5503) {
Branch: 1 branch
BranchTrueFalseTotal
if ($params{"BUILD_REQUIRES"} and $eumm_version < "6.5503") 0 0 0
Condition0%0/3
$params{"BUILD_REQUIRES"} and $eumm_version < "6.5503"
!ll&&!rl&&r
000
MC/DC0%0/2
$params{"BUILD_REQUIRES"} and $eumm_version < "6.5503"
$params{"BUILD_REQUIRES"} $eumm_version < "6.5503"
Truth table0%0/3
A and B
A= $params{"BUILD_REQUIRES"}B= $eumm_version < "6.5503"
ABresult
0X0
100
111
112 #EUMM 6.5502 has problems with BUILD_REQUIRES
113 0 ▶ $params{PREREQ_PM}={ %{$params{PREREQ_PM} || {}} , %{$params{BUILD_REQUIRES}} };
Branch: 1 branch
BranchTrueFalseTotal
$params{"PREREQ_PM"} or {} 0 0 0
114 0 delete $params{BUILD_REQUIRES};
115 }
116 0 ▶ if ($params{TEST_REQUIRES} and $eumm_version < 6.64) {
Branch: 1 branch
BranchTrueFalseTotal
if ($params{"TEST_REQUIRES"} and $eumm_version < "6.64") 0 0 0
Condition0%0/3
$params{"TEST_REQUIRES"} and $eumm_version < "6.64"
!ll&&!rl&&r
000
MC/DC0%0/2
$params{"TEST_REQUIRES"} and $eumm_version < "6.64"
$params{"TEST_REQUIRES"} $eumm_version < "6.64"
Truth table0%0/3
A and B
A= $params{"TEST_REQUIRES"}B= $eumm_version < "6.64"
ABresult
0X0
100
111
117 0 ▶ $params{PREREQ_PM}={ %{$params{PREREQ_PM} || {}} , %{$params{TEST_REQUIRES}} };
Branch: 1 branch
BranchTrueFalseTotal
$params{"PREREQ_PM"} or {} 0 0 0
118 0 delete $params{TEST_REQUIRES};
119 }
120 0 ▶ delete $params{CONFIGURE_REQUIRES} if $eumm_version < 6.52;
Branch: 1 branch
BranchTrueFalseTotal
if $eumm_version < "6.52" 0 0 0
121 0 ▶ delete $params{MIN_PERL_VERSION} if $eumm_version < 6.48;
Branch: 1 branch
BranchTrueFalseTotal
if $eumm_version < "6.48" 0 0 0
122 0 ▶ delete $params{META_MERGE} if $eumm_version < 6.46;
Branch: 1 branch
BranchTrueFalseTotal
if $eumm_version < "6.46" 0 0 0
123 0 ▶ delete $params{META_ADD} if $eumm_version < 6.46;
Branch: 1 branch
BranchTrueFalseTotal
if $eumm_version < "6.46" 0 0 0
124 0 ▶ delete $params{LICENSE} if $eumm_version < 6.31;
Branch: 1 branch
BranchTrueFalseTotal
if $eumm_version < "6.31" 0 0 0
125 0 ▶ delete $params{AUTHOR} if $] < 5.005;
Branch: 1 branch
BranchTrueFalseTotal
if $] < "5.005" 0 0 0
126 0 ▶ delete $params{ABSTRACT_FROM} if $] < 5.005;
Branch: 1 branch
BranchTrueFalseTotal
if $] < "5.005" 0 0 0
127 0 ▶ delete $params{BINARY_LOCATION} if $] < 5.005;
Branch: 1 branch
BranchTrueFalseTotal
if $] < "5.005" 0 0 0
128  
129 0 WriteMakefile(%params);
130 }
131  
132 sub regen_README {
133 # README is the short version that just tells people what this is
134 # and how to install it
135 0 ▶ my( $file, $version ) = @_;
Subroutine regen_README: not called CC=1 SCAR=6.9
136 0 eval {
137 # Get description
138 0 my $readme = join "\n",
139 pod_section($file, 'NAME', 'no heading' ),
140 pod_section($file, 'DESCRIPTION' ),
141 <<VERSION,
142 This document describes version $version.
143 VERSION
144 <<INSTALL,
145  
146 INSTALLATION
147  
148 This is a Perl module distribution. It should be installed with whichever
149 tool you use to manage your installation of Perl, e.g. any of
150  
151 cpanm .
152 cpan .
153 cpanp -i .
154  
155 Consult https://www.cpan.org/modules/INSTALL.html for further instruction.
156 Should you wish to install this module manually, the procedure is
157  
158 perl Makefile.PL
159 make
160 make test
161 make install
162  
163 INSTALL
164 pod_section($file, 'REPOSITORY'),
165 pod_section($file, 'SUPPORT'),
166 pod_section($file, 'TALKS'),
167 pod_section($file, 'KNOWN ISSUES'),
168 pod_section($file, 'BUG TRACKER'),
169 pod_section($file, 'CONTRIBUTING'),
170 pod_section($file, 'SEE ALSO'),
171 pod_section($file, 'AUTHOR'),
172 pod_section($file, 'LICENSE' ),
173 pod_section($file, 'COPYRIGHT' ),
174 ;
175 0 update_file( 'README', $readme );
176 };
177 # README.mkdn is the documentation that will be shown as the main
178 # page of the repository on Github. Hence we recreate the POD here
179 # as Markdown
180 0 eval {
181 0 require Pod::Markdown;
182  
183 0 my $parser = Pod::Markdown->new();
184  
185 # Read POD from Module.pm and write to README
186 0 $parser->parse_from_file($_[0]);
187 0 my $readme_mkdn = <<STATUS . $parser->as_markdown;
188  
189 [![Travis Build Status](https://travis-ci.org/Corion/$distlink.svg?branch=master)](https://travis-ci.org/Corion/$distlink)
190 [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/Corion/$distlink?branch=master&svg=true)](https://ci.appveyor.com/project/Corion/$distlink)
191  
192 STATUS
193 0 update_file( 'README.mkdn', $readme_mkdn );
194 };
195 }
196  
197 sub pod_section {
198 0 ▶ my( $filename, $section, $remove_heading ) = @_;
Subroutine pod_section: not called CC=9 SCAR=45.0
199 0 ▶ open my $fh, '<', $filename
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "<", $filename or die "Couldn't read '${filename}': $!" 0 0 0
200 or die "Couldn't read '$filename': $!";
201  
202 my @section =
203 0 grep { /^=head1\s+$section/.../^=/ } <$fh>;
204  
205 # Trim the section
206 0 ▶ if( @section ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@section) 0 0 0
207 0 ▶ pop @section if $section[-1] =~ /^=/;
Branch: 1 branch
BranchTrueFalseTotal
if $section[-1] =~ /^=/ 0 0 0
208 0 ▶ shift @section if $remove_heading;
Branch: 1 branch
BranchTrueFalseTotal
if $remove_heading 0 0 0
209  
210 pop @section
211 0 ▶ while @section and $section[-1] =~ /^\s*$/;
Branch: 1 branch
BranchTrueFalseTotal
@section and $section[-1] =~ /^\s*$/ and do { pop @section } 0 0 0
Condition0%0/3
@section and $section[-1] =~ /^\s*$/
!ll&&!rl&&r
000
MC/DC0%0/2
@section and $section[-1] =~ /^\s*$/
@section $section[-1] =~ /^\s*$/
Truth table0%0/3
A and B
A= @sectionB= $section[-1] =~ /^\s*$/
ABresult
0X0
100
111
212 shift @section
213 0 ▶ while @section and $section[0] =~ /^\s*$/;
Branch: 1 branch
BranchTrueFalseTotal
@section and $section[0] =~ /^\s*$/ and do { shift @section } 0 0 0
Condition0%0/3
@section and $section[0] =~ /^\s*$/
!ll&&!rl&&r
000
MC/DC0%0/2
@section and $section[0] =~ /^\s*$/
@section $section[0] =~ /^\s*$/
Truth table0%0/3
A and B
A= @sectionB= $section[0] =~ /^\s*$/
ABresult
0X0
100
111
214 };
215  
216 0 @section = map { $_ =~ s!^=\w+\s+!!; $_ } @section;
217 0 return join "", @section;
218 }
219  
220 sub regen_EXAMPLES {
221 0 ▶ my $perl = $^X;
Subroutine regen_EXAMPLES: not called CC=3 SCAR=24.8
222 0 ▶ if ($perl =~/\s/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($perl =~ /\s/) 0 0 0
223 0 $perl = qq{"$perl"};
224 };
225 0 (my $example_file = $main_file) =~ s!\.pm$!/Examples.pm!;
226 0 my $examples = `$perl -w examples/gen_examples_pod.pl`;
227 0 ▶ if ($examples) {
Branch: 1 branch
BranchTrueFalseTotal
if ($examples) 0 0 0
228 0 warn "(Re)Creating $example_file\n";
229 0 $examples =~ s/\r\n/\n/g;
230 0 update_file( $example_file, $examples );
231 };
232 };
233  
234 sub update_file {
235 0 ▶ my( $filename, $new_content ) = @_;
Subroutine update_file: not called CC=5 SCAR=34.0
236 0 my $content;
237 0 ▶ if( -f $filename ) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $filename) 0 0 0
238 0 ▶ open my $fh, '<:raw:encoding(UTF-8)', $filename
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "<:raw:encoding(UTF-8)", $filename or die "Couldn't read '${filename}': $!" 0 0 0
239 or die "Couldn't read '$filename': $!";
240 0 local $/;
241 0 $content = <$fh>;
242 };
243  
244 0 ▶ if( $content ne $new_content ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($content ne $new_content) 0 0 0
245 0 ▶ if( open my $fh, '>:raw:encoding(UTF-8)', $filename ) {
Branch: 1 branch
BranchTrueFalseTotal
if (open my $fh, '>:raw:encoding(UTF-8)', $filename) { } 0 0 0
246 0 print $fh $new_content;
247 } else {
248 0 warn "Couldn't (re)write '$filename': $!";
249 };
250 };
251 }
« blib/lib/HTTP/Request/FromWget.pm ↑ Summary blib/lib/HTTP/Request/CurlParameters.pm »