line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# -*- mode: perl; c-basic-offset: 4; indent-tabs-mode: nil; -*- |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
539
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
4
|
1
|
|
|
1
|
|
973
|
use ExtUtils::MakeMaker qw(WriteMakefile); |
|
1
|
|
|
|
|
120425
|
|
|
1
|
|
|
|
|
1466
|
|
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
|
|
|
|
|
|
|
my $eumm_version = $ExtUtils::MakeMaker::VERSION; |
11
|
|
|
|
|
|
|
$eumm_version =~ s/_//; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $module = 'Future::HTTP'; |
14
|
|
|
|
|
|
|
(my $main_file = "lib/$module.pm" ) =~ s!::!/!g; |
15
|
|
|
|
|
|
|
(my $distbase = $module) =~ s!::!-!g; |
16
|
|
|
|
|
|
|
my $distlink = $distbase; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my @tests = map { glob $_ } 't/*.t', 't/*/*.t'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my %module = ( |
21
|
|
|
|
|
|
|
NAME => $module, |
22
|
|
|
|
|
|
|
AUTHOR => q{Max Maischein }, |
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/$distlink", |
30
|
|
|
|
|
|
|
url => "git://github.com/Corion/$distlink.git", |
31
|
|
|
|
|
|
|
type => 'git', |
32
|
|
|
|
|
|
|
}, |
33
|
|
|
|
|
|
|
bugtracker => "https://rt.cpan.org/Public/Dist/Display.html?Name=$distbase", |
34
|
|
|
|
|
|
|
license => "https://dev.perl.org/licenses/", |
35
|
|
|
|
|
|
|
}, |
36
|
|
|
|
|
|
|
prereqs => { |
37
|
|
|
|
|
|
|
runtime => { |
38
|
|
|
|
|
|
|
recommends => { |
39
|
|
|
|
|
|
|
# For decoding the various content encodings |
40
|
|
|
|
|
|
|
'IO::Uncompress::Gunzip' => 0, |
41
|
|
|
|
|
|
|
'IO::Uncompress::Bunzip2' => 0, |
42
|
|
|
|
|
|
|
'IO::Uncompress::Inflate' => 0, |
43
|
|
|
|
|
|
|
'IO::Uncompress::RawInflate' => 0, |
44
|
|
|
|
|
|
|
'MIME::QuotedPrint' => 0, |
45
|
|
|
|
|
|
|
'MIME::Base64' => 0, |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
}, |
48
|
|
|
|
|
|
|
develop => { |
49
|
|
|
|
|
|
|
requires => { |
50
|
|
|
|
|
|
|
'AnyEvent::HTTP' => 0, |
51
|
|
|
|
|
|
|
'Net::Async::HTTP' => 0, |
52
|
|
|
|
|
|
|
'Mojo::UserAgent' => 0, |
53
|
|
|
|
|
|
|
'HTTP::Tiny::Paranoid' => 0, |
54
|
|
|
|
|
|
|
'HTTP::Tiny' => 0, |
55
|
|
|
|
|
|
|
}, |
56
|
|
|
|
|
|
|
}, |
57
|
|
|
|
|
|
|
}, |
58
|
|
|
|
|
|
|
dynamic_config => 0, # we promise to keep META.* up-to-date |
59
|
|
|
|
|
|
|
x_static_install => 1, # we are pure Perl and don't do anything fancy |
60
|
|
|
|
|
|
|
}, |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
MIN_PERL_VERSION => '5.006', |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
'LICENSE'=> 'perl', |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
PL_FILES => {}, |
67
|
|
|
|
|
|
|
BUILD_REQUIRES => { |
68
|
|
|
|
|
|
|
'ExtUtils::MakeMaker' => 0, |
69
|
|
|
|
|
|
|
}, |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
PREREQ_PM => { |
72
|
|
|
|
|
|
|
'Filter::signatures' => '0.13', # only needed for Perl <5.22 |
73
|
|
|
|
|
|
|
'Moo' => 2, # yeah, not all that great, but ... |
74
|
|
|
|
|
|
|
'Future' => '0.31', # Future 0.25 is incompatible as it doesn't allow Future->done |
75
|
|
|
|
|
|
|
'HTTP::Tiny' => 0, # our fallback, even distributed with Perl 5.14+ |
76
|
|
|
|
|
|
|
'HTTP::Headers' => '6.07', # we want the ->flatten() method |
77
|
|
|
|
|
|
|
}, |
78
|
|
|
|
|
|
|
TEST_REQUIRES => { |
79
|
|
|
|
|
|
|
'Test::More' => 0, |
80
|
|
|
|
|
|
|
'Data::Dumper' => 0, |
81
|
|
|
|
|
|
|
'Test::HTTP::LocalServer' => 0, |
82
|
|
|
|
|
|
|
}, |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, |
85
|
|
|
|
|
|
|
clean => { FILES => "$distbase-*" }, |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
test => { TESTS => join( ' ', @tests ) }, |
88
|
|
|
|
|
|
|
); |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# This is so that we can do |
91
|
|
|
|
|
|
|
# require 'Makefile.PL' |
92
|
|
|
|
|
|
|
# and then call get_module_info |
93
|
|
|
|
|
|
|
|
94
|
1
|
|
|
1
|
|
13
|
sub get_module_info { %module } |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
if( ! caller ) { |
97
|
|
|
|
|
|
|
# I should maybe use something like Shipwright... |
98
|
|
|
|
|
|
|
regen_README($main_file); |
99
|
|
|
|
|
|
|
regen_EXAMPLES() if -d 'examples'; |
100
|
|
|
|
|
|
|
WriteMakefile1(get_module_info); |
101
|
|
|
|
|
|
|
}; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
1; |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub WriteMakefile1 { #Written by Alexandr Ciornii, version 0.21. Added by eumm-upgrade. |
106
|
0
|
|
|
0
|
|
|
my %params=@_; |
107
|
0
|
|
|
|
|
|
my $eumm_version=$ExtUtils::MakeMaker::VERSION; |
108
|
0
|
|
|
|
|
|
$eumm_version=eval $eumm_version; |
109
|
0
|
0
|
|
|
|
|
die "EXTRA_META is deprecated" if exists $params{EXTRA_META}; |
110
|
0
|
0
|
|
|
|
|
die "License not specified" if not exists $params{LICENSE}; |
111
|
0
|
0
|
0
|
|
|
|
if ($params{BUILD_REQUIRES} and $eumm_version < 6.5503) { |
112
|
|
|
|
|
|
|
#EUMM 6.5502 has problems with BUILD_REQUIRES |
113
|
0
|
0
|
|
|
|
|
$params{PREREQ_PM}={ %{$params{PREREQ_PM} || {}} , %{$params{BUILD_REQUIRES}} }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
|
delete $params{BUILD_REQUIRES}; |
115
|
|
|
|
|
|
|
} |
116
|
0
|
0
|
0
|
|
|
|
if ($params{TEST_REQUIRES} and $eumm_version < 6.64) { |
117
|
0
|
0
|
|
|
|
|
$params{PREREQ_PM}={ %{$params{PREREQ_PM} || {}} , %{$params{TEST_REQUIRES}} }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
|
delete $params{TEST_REQUIRES}; |
119
|
|
|
|
|
|
|
} |
120
|
0
|
0
|
|
|
|
|
delete $params{CONFIGURE_REQUIRES} if $eumm_version < 6.52; |
121
|
0
|
0
|
|
|
|
|
delete $params{MIN_PERL_VERSION} if $eumm_version < 6.48; |
122
|
0
|
0
|
|
|
|
|
delete $params{META_MERGE} if $eumm_version < 6.46; |
123
|
0
|
0
|
|
|
|
|
delete $params{META_ADD} if $eumm_version < 6.46; |
124
|
0
|
0
|
|
|
|
|
delete $params{LICENSE} if $eumm_version < 6.31; |
125
|
0
|
0
|
|
|
|
|
delete $params{AUTHOR} if $] < 5.005; |
126
|
0
|
0
|
|
|
|
|
delete $params{ABSTRACT_FROM} if $] < 5.005; |
127
|
0
|
0
|
|
|
|
|
delete $params{BINARY_LOCATION} if $] < 5.005; |
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
|
|
|
0
|
|
|
eval { |
136
|
|
|
|
|
|
|
# Get description |
137
|
0
|
|
|
|
|
|
my $readme = join "\n", |
138
|
|
|
|
|
|
|
pod_section($_[0], 'NAME', 'no heading' ), |
139
|
|
|
|
|
|
|
pod_section($_[0], 'DESCRIPTION' ), |
140
|
|
|
|
|
|
|
<
|
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
INSTALLATION |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
This is a Perl module distribution. It should be installed with whichever |
145
|
|
|
|
|
|
|
tool you use to manage your installation of Perl, e.g. any of |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
cpanm . |
148
|
|
|
|
|
|
|
cpan . |
149
|
|
|
|
|
|
|
cpanp -i . |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Consult https://www.cpan.org/modules/INSTALL.html for further instruction. |
152
|
|
|
|
|
|
|
Should you wish to install this module manually, the procedure is |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
perl Makefile.PL |
155
|
|
|
|
|
|
|
make |
156
|
|
|
|
|
|
|
make test |
157
|
|
|
|
|
|
|
make install |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
INSTALL |
160
|
|
|
|
|
|
|
pod_section($_[0], 'REPOSITORY'), |
161
|
|
|
|
|
|
|
pod_section($_[0], 'SUPPORT'), |
162
|
|
|
|
|
|
|
pod_section($_[0], 'TALKS'), |
163
|
|
|
|
|
|
|
pod_section($_[0], 'KNOWN ISSUES'), |
164
|
|
|
|
|
|
|
pod_section($_[0], 'BUG TRACKER'), |
165
|
|
|
|
|
|
|
pod_section($_[0], 'CONTRIBUTING'), |
166
|
|
|
|
|
|
|
pod_section($_[0], 'SEE ALSO'), |
167
|
|
|
|
|
|
|
pod_section($_[0], 'AUTHOR'), |
168
|
|
|
|
|
|
|
pod_section($_[0], 'LICENSE' ), |
169
|
|
|
|
|
|
|
pod_section($_[0], 'COPYRIGHT' ), |
170
|
|
|
|
|
|
|
; |
171
|
0
|
|
|
|
|
|
update_file( 'README', $readme ); |
172
|
|
|
|
|
|
|
}; |
173
|
|
|
|
|
|
|
# README.mkdn is the documentation that will be shown as the main |
174
|
|
|
|
|
|
|
# page of the repository on Github. Hence we recreate the POD here |
175
|
|
|
|
|
|
|
# as Markdown |
176
|
0
|
|
|
|
|
|
eval { |
177
|
0
|
|
|
|
|
|
require Pod::Markdown; |
178
|
|
|
|
|
|
|
|
179
|
0
|
|
|
|
|
|
my $parser = Pod::Markdown->new(); |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
# Read POD from Module.pm and write to README |
182
|
0
|
|
|
|
|
|
$parser->parse_from_file($_[0]); |
183
|
0
|
|
|
|
|
|
my $readme_mkdn = <as_markdown; |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
[![Travis Build Status](https://travis-ci.org/Corion/$distlink.svg?branch=master)](https://travis-ci.org/Corion/$distlink) |
186
|
|
|
|
|
|
|
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/Corion/$distlink?branch=master&svg=true)](https://ci.appveyor.com/project/Corion/$distlink) |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
STATUS |
189
|
0
|
|
|
|
|
|
update_file( 'README.mkdn', $readme_mkdn ); |
190
|
|
|
|
|
|
|
}; |
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
sub pod_section { |
194
|
0
|
|
|
0
|
|
|
my( $filename, $section, $remove_heading ) = @_; |
195
|
0
|
0
|
|
|
|
|
open my $fh, '<', $filename |
196
|
|
|
|
|
|
|
or die "Couldn't read '$filename': $!"; |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
my @section = |
199
|
0
|
|
|
|
|
|
grep { /^=head1\s+$section/.../^=/ } <$fh>; |
|
0
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
# Trim the section |
202
|
0
|
0
|
|
|
|
|
if( @section ) { |
203
|
0
|
0
|
|
|
|
|
pop @section if $section[-1] =~ /^=/; |
204
|
0
|
0
|
|
|
|
|
shift @section if $remove_heading; |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
pop @section |
207
|
0
|
|
0
|
|
|
|
while @section and $section[-1] =~ /^\s*$/; |
208
|
|
|
|
|
|
|
shift @section |
209
|
0
|
|
0
|
|
|
|
while @section and $section[0] =~ /^\s*$/; |
210
|
|
|
|
|
|
|
}; |
211
|
|
|
|
|
|
|
|
212
|
0
|
|
|
|
|
|
@section = map { $_ =~ s!^=\w+\s+!!; $_ } @section; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
213
|
0
|
|
|
|
|
|
return join "", @section; |
214
|
|
|
|
|
|
|
} |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
sub regen_EXAMPLES { |
217
|
0
|
|
|
0
|
|
|
my $perl = $^X; |
218
|
0
|
0
|
|
|
|
|
if ($perl =~/\s/) { |
219
|
0
|
|
|
|
|
|
$perl = qq{"$perl"}; |
220
|
|
|
|
|
|
|
}; |
221
|
0
|
|
|
|
|
|
(my $example_file = $main_file) =~ s!\.pm$!/Examples.pm!; |
222
|
0
|
|
|
|
|
|
my $examples = `$perl -w examples/gen_examples_pod.pl`; |
223
|
0
|
0
|
|
|
|
|
if ($examples) { |
224
|
0
|
|
|
|
|
|
warn "(Re)Creating $example_file\n"; |
225
|
0
|
|
|
|
|
|
$examples =~ s/\r\n/\n/g; |
226
|
0
|
|
|
|
|
|
update_file( $example_file, $examples ); |
227
|
|
|
|
|
|
|
}; |
228
|
|
|
|
|
|
|
}; |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
sub update_file { |
231
|
0
|
|
|
0
|
|
|
my( $filename, $new_content ) = @_; |
232
|
0
|
|
|
|
|
|
my $content; |
233
|
0
|
0
|
|
|
|
|
if( -f $filename ) { |
234
|
0
|
0
|
|
|
|
|
open my $fh, '<', $filename |
235
|
|
|
|
|
|
|
or die "Couldn't read '$filename': $!"; |
236
|
0
|
|
|
|
|
|
binmode $fh; |
237
|
0
|
|
|
|
|
|
local $/; |
238
|
0
|
|
|
|
|
|
$content = <$fh>; |
239
|
|
|
|
|
|
|
}; |
240
|
|
|
|
|
|
|
|
241
|
0
|
0
|
|
|
|
|
if( $content ne $new_content ) { |
242
|
0
|
0
|
|
|
|
|
if( open my $fh, '>', $filename ) { |
243
|
0
|
|
|
|
|
|
binmode $fh; |
244
|
0
|
|
|
|
|
|
print $fh $new_content; |
245
|
|
|
|
|
|
|
} else { |
246
|
0
|
|
|
|
|
|
warn "Couldn't (re)write '$filename': $!"; |
247
|
|
|
|
|
|
|
}; |
248
|
|
|
|
|
|
|
}; |
249
|
|
|
|
|
|
|
} |