line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# -*- mode: perl; c-basic-offset: 4; indent-tabs-mode: nil; -*- |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
413
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
33
|
|
4
|
1
|
|
|
1
|
|
883
|
use ExtUtils::MakeMaker qw(WriteMakefile); |
|
1
|
|
|
|
|
107660
|
|
|
1
|
|
|
|
|
1266
|
|
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 = 'Mail::URLFor'; |
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
|
|
|
|
|
|
|
}, |
34
|
|
|
|
|
|
|
dynamic_config => 0, # we promise to keep META.* up-to-date |
35
|
|
|
|
|
|
|
x_static_install => 1, # we are pure Perl and don't do anything fancy |
36
|
|
|
|
|
|
|
}, |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
MIN_PERL_VERSION => '5.008', # I use // in some places |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
'LICENSE'=> 'perl', |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
PL_FILES => {}, |
43
|
|
|
|
|
|
|
BUILD_REQUIRES => { |
44
|
|
|
|
|
|
|
'ExtUtils::MakeMaker' => 0, |
45
|
|
|
|
|
|
|
}, |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
PREREQ_PM => { |
48
|
|
|
|
|
|
|
'Moo' => 2, |
49
|
|
|
|
|
|
|
'Moo::Role' => 0, |
50
|
|
|
|
|
|
|
'Filter::signatures' => '0.09', |
51
|
|
|
|
|
|
|
'URI' => 0, |
52
|
|
|
|
|
|
|
'URI::Escape' => 0, |
53
|
|
|
|
|
|
|
'URI::mid' => 0, |
54
|
|
|
|
|
|
|
'Module::Pluggable' => 0, |
55
|
|
|
|
|
|
|
'namespace::autoclean' => 0, |
56
|
|
|
|
|
|
|
}, |
57
|
|
|
|
|
|
|
TEST_REQUIRES => { |
58
|
|
|
|
|
|
|
'Test::More' => 0, |
59
|
|
|
|
|
|
|
'Data::Dumper' => 0, |
60
|
|
|
|
|
|
|
}, |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, |
63
|
|
|
|
|
|
|
clean => { FILES => "$distbase-*" }, |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
test => { TESTS => join( ' ', @tests ) }, |
66
|
|
|
|
|
|
|
); |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# This is so that we can do |
69
|
|
|
|
|
|
|
# require 'Makefile.PL' |
70
|
|
|
|
|
|
|
# and then call get_module_info |
71
|
|
|
|
|
|
|
|
72
|
1
|
|
|
1
|
|
12
|
sub get_module_info { %module } |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
if( ! caller ) { |
75
|
|
|
|
|
|
|
# I should maybe use something like Shipwright... |
76
|
|
|
|
|
|
|
regen_README($main_file); |
77
|
|
|
|
|
|
|
regen_EXAMPLES() if -d 'examples'; |
78
|
|
|
|
|
|
|
WriteMakefile1(get_module_info); |
79
|
|
|
|
|
|
|
}; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub WriteMakefile1 { #Written by Alexandr Ciornii, version 0.21. Added by eumm-upgrade. |
84
|
0
|
|
|
0
|
|
|
my %params=@_; |
85
|
0
|
|
|
|
|
|
my $eumm_version=$ExtUtils::MakeMaker::VERSION; |
86
|
0
|
|
|
|
|
|
$eumm_version=eval $eumm_version; |
87
|
0
|
0
|
|
|
|
|
die "EXTRA_META is deprecated" if exists $params{EXTRA_META}; |
88
|
0
|
0
|
|
|
|
|
die "License not specified" if not exists $params{LICENSE}; |
89
|
0
|
0
|
0
|
|
|
|
if ($params{BUILD_REQUIRES} and $eumm_version < 6.5503) { |
90
|
|
|
|
|
|
|
#EUMM 6.5502 has problems with BUILD_REQUIRES |
91
|
0
|
0
|
|
|
|
|
$params{PREREQ_PM}={ %{$params{PREREQ_PM} || {}} , %{$params{BUILD_REQUIRES}} }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
delete $params{BUILD_REQUIRES}; |
93
|
|
|
|
|
|
|
} |
94
|
0
|
0
|
0
|
|
|
|
if ($params{TEST_REQUIRES} and $eumm_version < 6.64) { |
95
|
0
|
0
|
|
|
|
|
$params{PREREQ_PM}={ %{$params{PREREQ_PM} || {}} , %{$params{TEST_REQUIRES}} }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
delete $params{TEST_REQUIRES}; |
97
|
|
|
|
|
|
|
} |
98
|
0
|
0
|
|
|
|
|
delete $params{CONFIGURE_REQUIRES} if $eumm_version < 6.52; |
99
|
0
|
0
|
|
|
|
|
delete $params{MIN_PERL_VERSION} if $eumm_version < 6.48; |
100
|
0
|
0
|
|
|
|
|
delete $params{META_MERGE} if $eumm_version < 6.46; |
101
|
0
|
0
|
|
|
|
|
delete $params{META_ADD} if $eumm_version < 6.46; |
102
|
0
|
0
|
|
|
|
|
delete $params{LICENSE} if $eumm_version < 6.31; |
103
|
0
|
0
|
|
|
|
|
delete $params{AUTHOR} if $] < 5.005; |
104
|
0
|
0
|
|
|
|
|
delete $params{ABSTRACT_FROM} if $] < 5.005; |
105
|
0
|
0
|
|
|
|
|
delete $params{BINARY_LOCATION} if $] < 5.005; |
106
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
WriteMakefile(%params); |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub regen_README { |
111
|
|
|
|
|
|
|
# README is the short version that just tells people what this is |
112
|
|
|
|
|
|
|
# and how to install it |
113
|
0
|
|
|
0
|
|
|
eval { |
114
|
|
|
|
|
|
|
# Get description |
115
|
0
|
|
|
|
|
|
my $readme = join "\n", |
116
|
|
|
|
|
|
|
pod_section($_[0], 'NAME', 'no heading' ), |
117
|
|
|
|
|
|
|
pod_section($_[0], 'DESCRIPTION' ), |
118
|
|
|
|
|
|
|
<
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
INSTALLATION |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
This is a Perl module distribution. It should be installed with whichever |
123
|
|
|
|
|
|
|
tool you use to manage your installation of Perl, e.g. any of |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
cpanm . |
126
|
|
|
|
|
|
|
cpan . |
127
|
|
|
|
|
|
|
cpanp -i . |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Consult http://www.cpan.org/modules/INSTALL.html for further instruction. |
130
|
|
|
|
|
|
|
Should you wish to install this module manually, the procedure is |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
perl Makefile.PL |
133
|
|
|
|
|
|
|
make |
134
|
|
|
|
|
|
|
make test |
135
|
|
|
|
|
|
|
make install |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
INSTALL |
138
|
|
|
|
|
|
|
pod_section($_[0], 'REPOSITORY'), |
139
|
|
|
|
|
|
|
pod_section($_[0], 'SUPPORT'), |
140
|
|
|
|
|
|
|
pod_section($_[0], 'TALKS'), |
141
|
|
|
|
|
|
|
pod_section($_[0], 'KNOWN ISSUES'), |
142
|
|
|
|
|
|
|
pod_section($_[0], 'BUG TRACKER'), |
143
|
|
|
|
|
|
|
pod_section($_[0], 'CONTRIBUTING'), |
144
|
|
|
|
|
|
|
pod_section($_[0], 'SEE ALSO'), |
145
|
|
|
|
|
|
|
pod_section($_[0], 'AUTHOR'), |
146
|
|
|
|
|
|
|
pod_section($_[0], 'LICENSE' ), |
147
|
|
|
|
|
|
|
pod_section($_[0], 'COPYRIGHT' ), |
148
|
|
|
|
|
|
|
; |
149
|
0
|
|
|
|
|
|
update_file( 'README', $readme ); |
150
|
|
|
|
|
|
|
}; |
151
|
|
|
|
|
|
|
# README.mkdn is the documentation that will be shown as the main |
152
|
|
|
|
|
|
|
# page of the repository on Github. Hence we recreate the POD here |
153
|
|
|
|
|
|
|
# as Markdown |
154
|
0
|
|
|
|
|
|
eval { |
155
|
0
|
|
|
|
|
|
require Pod::Markdown; |
156
|
|
|
|
|
|
|
|
157
|
0
|
|
|
|
|
|
my $parser = Pod::Markdown->new(); |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
# Read POD from Module.pm and write to README |
160
|
0
|
|
|
|
|
|
$parser->parse_from_file($_[0]); |
161
|
0
|
|
|
|
|
|
my $readme_mkdn = <as_markdown; |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
[![Travis Build Status](https://travis-ci.org/Corion/$distlink.svg?branch=master)](https://travis-ci.org/Corion/$distlink) |
164
|
|
|
|
|
|
|
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/Corion/$distlink?branch=master&svg=true)](https://ci.appveyor.com/project/Corion/$distlink) |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
STATUS |
167
|
0
|
|
|
|
|
|
update_file( 'README.mkdn', $readme_mkdn ); |
168
|
|
|
|
|
|
|
}; |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
sub pod_section { |
172
|
0
|
|
|
0
|
|
|
my( $filename, $section, $remove_heading ) = @_; |
173
|
0
|
0
|
|
|
|
|
open my $fh, '<', $filename |
174
|
|
|
|
|
|
|
or die "Couldn't read '$filename': $!"; |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
my @section = |
177
|
0
|
|
|
|
|
|
grep { /^=head1\s+$section/.../^=/ } <$fh>; |
|
0
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
# Trim the section |
180
|
0
|
0
|
|
|
|
|
if( @section ) { |
181
|
0
|
0
|
|
|
|
|
pop @section if $section[-1] =~ /^=/; |
182
|
0
|
0
|
|
|
|
|
shift @section if $remove_heading; |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
pop @section |
185
|
0
|
|
|
|
|
|
while $section[-1] =~ /^\s*$/; |
186
|
|
|
|
|
|
|
shift @section |
187
|
0
|
|
|
|
|
|
while $section[0] =~ /^\s*$/; |
188
|
|
|
|
|
|
|
}; |
189
|
|
|
|
|
|
|
|
190
|
0
|
|
|
|
|
|
@section = map { $_ =~ s!^=\w+\s+!!; $_ } @section; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
191
|
0
|
|
|
|
|
|
return join "", @section; |
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
sub regen_EXAMPLES { |
195
|
0
|
|
|
0
|
|
|
my $perl = $^X; |
196
|
0
|
0
|
|
|
|
|
if ($perl =~/\s/) { |
197
|
0
|
|
|
|
|
|
$perl = qq{"$perl"}; |
198
|
|
|
|
|
|
|
}; |
199
|
0
|
|
|
|
|
|
(my $example_file = $main_file) =~ s!\.pm$!/Examples.pm!; |
200
|
0
|
|
|
|
|
|
my $examples = `$perl -w examples/gen_examples_pod.pl`; |
201
|
0
|
0
|
|
|
|
|
if ($examples) { |
202
|
0
|
|
|
|
|
|
warn "(Re)Creating $example_file\n"; |
203
|
0
|
|
|
|
|
|
$examples =~ s/\r\n/\n/g; |
204
|
0
|
|
|
|
|
|
update_file( $example_file, $examples ); |
205
|
|
|
|
|
|
|
}; |
206
|
|
|
|
|
|
|
}; |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
sub update_file { |
209
|
0
|
|
|
0
|
|
|
my( $filename, $new_content ) = @_; |
210
|
0
|
|
|
|
|
|
my $content; |
211
|
0
|
0
|
|
|
|
|
if( -f $filename ) { |
212
|
0
|
0
|
|
|
|
|
open my $fh, '<', $filename |
213
|
|
|
|
|
|
|
or die "Couldn't read '$filename': $!"; |
214
|
0
|
|
|
|
|
|
binmode $fh; |
215
|
0
|
|
|
|
|
|
local $/; |
216
|
0
|
|
|
|
|
|
$content = <$fh>; |
217
|
|
|
|
|
|
|
}; |
218
|
|
|
|
|
|
|
|
219
|
0
|
0
|
|
|
|
|
if( $content ne $new_content ) { |
220
|
0
|
0
|
|
|
|
|
if( open my $fh, '>', $filename ) { |
221
|
0
|
|
|
|
|
|
binmode $fh; |
222
|
0
|
|
|
|
|
|
print $fh $new_content; |
223
|
|
|
|
|
|
|
} else { |
224
|
0
|
|
|
|
|
|
warn "Couldn't (re)write '$filename': $!"; |
225
|
|
|
|
|
|
|
}; |
226
|
|
|
|
|
|
|
}; |
227
|
|
|
|
|
|
|
} |