line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
require 5.006; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
use strict; |
5
|
2
|
|
|
2
|
|
21015
|
use warnings; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
50
|
|
6
|
2
|
|
|
2
|
|
10
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
238
|
|
7
|
|
|
|
|
|
|
require Exporter; |
8
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @EXPORT = qw(test_harness pod2man perllocal_install uninstall |
11
|
|
|
|
|
|
|
warn_if_old_packlist test_s cp_nonempty); |
12
|
|
|
|
|
|
|
our $VERSION = '7.64'; |
13
|
|
|
|
|
|
|
$VERSION =~ tr/_//d; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $Is_VMS = $^O eq 'VMS'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
no warnings 'redefine'; |
18
|
|
|
|
|
|
|
local $@; |
19
|
2
|
|
|
2
|
|
13
|
*mtime = (eval { require Time::HiRes } && defined &Time::HiRes::stat) |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
2049
|
|
20
|
0
|
|
|
0
|
0
|
0
|
? sub { (Time::HiRes::stat($_[0]))[9] } |
21
|
|
|
|
|
|
|
: sub { ( stat($_[0]))[9] } |
22
|
0
|
|
|
0
|
|
0
|
; |
23
|
0
|
|
|
0
|
|
0
|
goto &mtime; |
24
|
0
|
0
|
0
|
|
|
0
|
} |
25
|
0
|
|
|
|
|
0
|
|
26
|
|
|
|
|
|
|
=head1 NAME |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
ExtUtils::Command::MM - Commands for the MM's to use in Makefiles |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 SYNOPSIS |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
perl "-MExtUtils::Command::MM" -e "function" "--" arguments... |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 DESCRIPTION |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
B<FOR INTERNAL USE ONLY!> The interface is not stable. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
ExtUtils::Command::MM encapsulates code which would otherwise have to |
40
|
|
|
|
|
|
|
be done with large "one" liners. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Any $(FOO) used in the examples are make variables, not Perl. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=over 4 |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=item B<test_harness> |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
test_harness($verbose, @test_libs); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Runs the tests on @ARGV via Test::Harness passing through the $verbose |
51
|
|
|
|
|
|
|
flag. Any @test_libs will be unshifted onto the test's @INC. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
@test_libs are run in alphabetical order. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
require Test::Harness; |
58
|
|
|
|
|
|
|
require File::Spec; |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
0
|
1
|
0
|
$Test::Harness::verbose = shift; |
61
|
0
|
|
|
|
|
0
|
|
62
|
|
|
|
|
|
|
# Because Windows doesn't do this for us and listing all the *.t files |
63
|
0
|
|
|
|
|
0
|
# out on the command line can blow over its exec limit. |
64
|
|
|
|
|
|
|
require ExtUtils::Command; |
65
|
|
|
|
|
|
|
my @argv = ExtUtils::Command::expand_wildcards(@ARGV); |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
0
|
local @INC = @INC; |
68
|
0
|
|
|
|
|
0
|
unshift @INC, map { File::Spec->rel2abs($_) } @_; |
69
|
|
|
|
|
|
|
Test::Harness::runtests(sort { lc $a cmp lc $b } @argv); |
70
|
0
|
|
|
|
|
0
|
} |
71
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
72
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=item B<pod2man> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
pod2man( '--option=value', |
77
|
|
|
|
|
|
|
$podfile1 => $manpage1, |
78
|
|
|
|
|
|
|
$podfile2 => $manpage2, |
79
|
|
|
|
|
|
|
... |
80
|
|
|
|
|
|
|
); |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# or args on @ARGV |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
pod2man() is a function performing most of the duties of the pod2man |
85
|
|
|
|
|
|
|
program. Its arguments are exactly the same as pod2man as of 5.8.0 |
86
|
|
|
|
|
|
|
with the addition of: |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
--perm_rw octal permission to set the resulting manpage to |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
And the removal of: |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
--verbose/-v |
93
|
|
|
|
|
|
|
--help/-h |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
If no arguments are given to pod2man it will read from @ARGV. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
If Pod::Man is unavailable, this function will warn and return undef. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=cut |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
local @ARGV = @_ ? @_ : @ARGV; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
{ |
104
|
|
|
|
|
|
|
local $@; |
105
|
2
|
100
|
|
2
|
1
|
1083
|
if( !eval { require Pod::Man } ) { |
106
|
|
|
|
|
|
|
warn "Pod::Man is not available: $@". |
107
|
|
|
|
|
|
|
"Man pages will not be generated during this install.\n"; |
108
|
2
|
|
|
|
|
4
|
return 0; |
|
2
|
|
|
|
|
4
|
|
109
|
2
|
100
|
|
|
|
4
|
} |
|
2
|
|
|
|
|
655
|
|
110
|
1
|
|
|
|
|
17
|
} |
111
|
|
|
|
|
|
|
require Getopt::Long; |
112
|
1
|
|
|
|
|
11
|
|
113
|
|
|
|
|
|
|
# We will cheat and just use Getopt::Long. We fool it by putting |
114
|
|
|
|
|
|
|
# our arguments into @ARGV. Should be safe. |
115
|
1
|
|
|
|
|
47483
|
my %options = (); |
116
|
|
|
|
|
|
|
Getopt::Long::config ('bundling_override'); |
117
|
|
|
|
|
|
|
Getopt::Long::GetOptions (\%options, |
118
|
|
|
|
|
|
|
'section|s=s', 'release|r=s', 'center|c=s', |
119
|
1
|
|
|
|
|
8796
|
'date|d=s', 'fixed=s', 'fixedbold=s', 'fixeditalic=s', |
120
|
1
|
|
|
|
|
4
|
'fixedbolditalic=s', 'official|o', 'quotes|q=s', 'lax|l', |
121
|
1
|
|
|
|
|
33
|
'name|n=s', 'perm_rw=i', 'utf8|u' |
122
|
|
|
|
|
|
|
); |
123
|
|
|
|
|
|
|
delete $options{utf8} unless $Pod::Man::VERSION >= 2.17; |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
# If there's no files, don't bother going further. |
126
|
|
|
|
|
|
|
return 0 unless @ARGV; |
127
|
1
|
50
|
|
|
|
902
|
|
128
|
|
|
|
|
|
|
# Official sets --center, but don't override things explicitly set. |
129
|
|
|
|
|
|
|
if ($options{official} && !defined $options{center}) { |
130
|
1
|
50
|
|
|
|
4
|
$options{center} = q[Perl Programmer's Reference Guide]; |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
0
|
0
|
0
|
|
|
|
# This isn't a valid Pod::Man option and is only accepted for backwards |
134
|
0
|
|
|
|
|
|
# compatibility. |
135
|
|
|
|
|
|
|
delete $options{lax}; |
136
|
|
|
|
|
|
|
my $count = scalar @ARGV / 2; |
137
|
|
|
|
|
|
|
my $plural = $count == 1 ? 'document' : 'documents'; |
138
|
|
|
|
|
|
|
print "Manifying $count pod $plural\n"; |
139
|
0
|
|
|
|
|
|
|
140
|
0
|
|
|
|
|
|
do {{ # so 'next' works |
141
|
0
|
0
|
|
|
|
|
my ($pod, $man) = splice(@ARGV, 0, 2); |
142
|
0
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
next if ((-e $man) && |
144
|
0
|
|
|
|
|
|
(mtime($man) > mtime($pod)) && |
145
|
0
|
|
|
|
|
|
(mtime($man) > mtime("Makefile"))); |
|
0
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
|
147
|
0
|
0
|
0
|
|
|
|
my $parser = Pod::Man->new(%options); |
|
|
|
0
|
|
|
|
|
148
|
|
|
|
|
|
|
$parser->parse_from_file($pod, $man) |
149
|
|
|
|
|
|
|
or do { warn("Could not install $man\n"); next }; |
150
|
|
|
|
|
|
|
|
151
|
0
|
|
|
|
|
|
if (exists $options{perm_rw}) { |
152
|
|
|
|
|
|
|
chmod(oct($options{perm_rw}), $man) |
153
|
0
|
0
|
|
|
|
|
or do { warn("chmod $options{perm_rw} $man: $!\n"); next }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
} |
155
|
0
|
0
|
|
|
|
|
}} while @ARGV; |
156
|
|
|
|
|
|
|
|
157
|
0
|
0
|
|
|
|
|
return 1; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
|
161
|
0
|
|
|
|
|
|
=item B<warn_if_old_packlist> |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
perl "-MExtUtils::Command::MM" -e warn_if_old_packlist <somefile> |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
Displays a warning that an old packlist file was found. Reads the |
166
|
|
|
|
|
|
|
filename from @ARGV. |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=cut |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
my $packlist = $ARGV[0]; |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
return unless -f $packlist; |
173
|
|
|
|
|
|
|
print <<"PACKLIST_WARNING"; |
174
|
|
|
|
|
|
|
WARNING: I have found an old package in |
175
|
0
|
|
|
0
|
1
|
|
$packlist. |
176
|
|
|
|
|
|
|
Please make sure the two installations are not conflicting |
177
|
0
|
0
|
|
|
|
|
PACKLIST_WARNING |
178
|
0
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=item B<perllocal_install> |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
perl "-MExtUtils::Command::MM" -e perllocal_install |
185
|
|
|
|
|
|
|
<type> <module name> <key> <value> ... |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
# VMS only, key|value pairs come on STDIN |
188
|
|
|
|
|
|
|
perl "-MExtUtils::Command::MM" -e perllocal_install |
189
|
|
|
|
|
|
|
<type> <module name> < <key>|<value> ... |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
Prints a fragment of POD suitable for appending to perllocal.pod. |
192
|
|
|
|
|
|
|
Arguments are read from @ARGV. |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
'type' is the type of what you're installing. Usually 'Module'. |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
'module name' is simply the name of your module. (Foo::Bar) |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
Key/value pairs are extra information about the module. Fields include: |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
installed into which directory your module was out into |
201
|
|
|
|
|
|
|
LINKTYPE dynamic or static linking |
202
|
|
|
|
|
|
|
VERSION module version number |
203
|
|
|
|
|
|
|
EXE_FILES any executables installed in a space separated |
204
|
|
|
|
|
|
|
list |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=cut |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
my($type, $name) = splice(@ARGV, 0, 2); |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
# VMS feeds args as a piped file on STDIN since it usually can't |
211
|
|
|
|
|
|
|
# fit all the args on a single command line. |
212
|
|
|
|
|
|
|
my @mod_info = $Is_VMS ? split /\|/, <STDIN> |
213
|
|
|
|
|
|
|
: @ARGV; |
214
|
0
|
|
|
0
|
1
|
|
|
215
|
|
|
|
|
|
|
my $pod; |
216
|
|
|
|
|
|
|
my $time = gmtime($ENV{SOURCE_DATE_EPOCH} || time); |
217
|
|
|
|
|
|
|
$pod = sprintf <<'POD', scalar($time), $type, $name, $name; |
218
|
0
|
0
|
|
|
|
|
=head2 %s: C<%s> L<%s|%s> |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=over 4 |
221
|
0
|
|
|
|
|
|
|
222
|
0
|
|
0
|
|
|
|
POD |
223
|
0
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
do { |
225
|
|
|
|
|
|
|
my($key, $val) = splice(@mod_info, 0, 2); |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
$pod .= <<POD |
228
|
|
|
|
|
|
|
=item * |
229
|
|
|
|
|
|
|
|
230
|
0
|
|
|
|
|
|
C<$key: $val> |
231
|
0
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
POD |
233
|
0
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
} while(@mod_info); |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
$pod .= "=back\n\n"; |
237
|
|
|
|
|
|
|
$pod =~ s/^ //mg; |
238
|
|
|
|
|
|
|
print $pod; |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
return 1; |
241
|
|
|
|
|
|
|
} |
242
|
0
|
|
|
|
|
|
|
243
|
0
|
|
|
|
|
|
=item B<uninstall> |
244
|
0
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
perl "-MExtUtils::Command::MM" -e uninstall <packlist> |
246
|
0
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
A wrapper around ExtUtils::Install::uninstall(). Warns that |
248
|
|
|
|
|
|
|
uninstallation is deprecated and doesn't actually perform the |
249
|
|
|
|
|
|
|
uninstallation. |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=cut |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
my($packlist) = shift @ARGV; |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
require ExtUtils::Install; |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
print <<'WARNING'; |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
Uninstall is unsafe and deprecated, the uninstallation was not performed. |
260
|
0
|
|
|
0
|
1
|
|
We will show what would have been done. |
261
|
|
|
|
|
|
|
|
262
|
0
|
|
|
|
|
|
WARNING |
263
|
|
|
|
|
|
|
|
264
|
0
|
|
|
|
|
|
ExtUtils::Install::uninstall($packlist, 1, 1); |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
print <<'WARNING'; |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
Uninstall is unsafe and deprecated, the uninstallation was not performed. |
269
|
|
|
|
|
|
|
Please check the list above carefully, there may be errors. |
270
|
|
|
|
|
|
|
Remove the appropriate files manually. |
271
|
0
|
|
|
|
|
|
Sorry for the inconvenience. |
272
|
|
|
|
|
|
|
|
273
|
0
|
|
|
|
|
|
WARNING |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
} |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
=item B<test_s> |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
perl "-MExtUtils::Command::MM" -e test_s <file> |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
Tests if a file exists and is not empty (size > 0). |
282
|
|
|
|
|
|
|
I<Exits> with 0 if it does, 1 if it does not. |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
=cut |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
exit(-s $ARGV[0] ? 0 : 1); |
287
|
|
|
|
|
|
|
} |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
=item B<cp_nonempty> |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
perl "-MExtUtils::Command::MM" -e cp_nonempty <srcfile> <dstfile> <perm> |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
Tests if the source file exists and is not empty (size > 0). If it is not empty |
294
|
0
|
0
|
|
0
|
1
|
|
it copies it to the given destination with the given permissions. |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
=back |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
=cut |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
my @args = @ARGV; |
301
|
|
|
|
|
|
|
return 0 unless -s $args[0]; |
302
|
|
|
|
|
|
|
require ExtUtils::Command; |
303
|
|
|
|
|
|
|
{ |
304
|
|
|
|
|
|
|
local @ARGV = @args[0,1]; |
305
|
|
|
|
|
|
|
ExtUtils::Command::cp(@ARGV); |
306
|
|
|
|
|
|
|
} |
307
|
|
|
|
|
|
|
{ |
308
|
|
|
|
|
|
|
local @ARGV = @args[2,1]; |
309
|
0
|
|
|
0
|
1
|
|
ExtUtils::Command::chmod(@ARGV); |
310
|
0
|
0
|
|
|
|
|
} |
311
|
0
|
|
|
|
|
|
} |
312
|
|
|
|
|
|
|
|
313
|
0
|
|
|
|
|
|
|
314
|
0
|
|
|
|
|
|
1; |