blib/lib/ExtUtils/Manifest.pm

filter: Statementstmt 76.9% 273 / 355 Branchbran 55.5% 120 / 216 Conditioncond 35.7% 20 / 56 MC/DCmcdc 12.5% 4 / 32 Subroutinesub 86.8% 33 / 38 Podpod 66.6% 10 / 15 totaltotal 64.6% 460 / 712 CC 127 SCAR 27.1
CC
127
Cov
66%
cp_if_diff
35.5
maniread
33.0
ln
30.0
CRAP 15.0
↑ Summary
1 package ExtUtils::Manifest; # git description: 1.74-10-g1bddbb0
2  
3 1 require Exporter;
4 1 ▶use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use File::Basename;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use File::Copy 'copy';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use File::Find;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use File::Spec 0.8;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 our $VERSION = '1.75';
14 1 our @ISA = ('Exporter');
15 1 our @EXPORT_OK = qw(mkmanifest
16 manicheck filecheck fullcheck skipcheck
17 manifind maniread manicopy maniadd
18 maniskip
19 );
20  
21 1 our $Is_VMS = $^O eq 'VMS';
22 1 our $Is_VMS_mode = 0;
23 1 our $Is_VMS_lc = 0;
24 1 our $Is_VMS_nodot = 0; # No dots in dir names or double dots in files
25  
26 1 ▶if ($Is_VMS) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ExtUtils::Manifest::Is_VMS) 0 1 1
27 0 ▶ require VMS::Filespec if $Is_VMS;
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::Manifest::Is_VMS 0 0 0
28 0 my $vms_unix_rpt;
29 my $vms_efs;
30 0 my $vms_case;
31  
32 0 $Is_VMS_mode = 1;
33 0 $Is_VMS_lc = 1;
34 0 $Is_VMS_nodot = 1;
35 0 ▶ if (eval { local $SIG{__DIE__}; require VMS::Feature; }) {
Branch: 1 branch
BranchTrueFalseTotal
if (eval { do { local $SIG{'__DIE__'}; require VMS::Feature } }) { } 0 0 0
36 0 $vms_unix_rpt = VMS::Feature::current("filename_unix_report");
37 0 $vms_efs = VMS::Feature::current("efs_charset");
38 0 $vms_case = VMS::Feature::current("efs_case_preserve");
39 } else {
40 0 ▶ my $unix_rpt = $ENV{'DECC$FILENAME_UNIX_REPORT'} || '';
Condition0%0/2
$ENV{'DECC$FILENAME_UNIX_REPORT'} || ''
l!l
00
MC/DC0%0/1
$ENV{'DECC$FILENAME_UNIX_REPORT'} || ''
$ENV{'DECC$FILENAME_UNIX_REPORT'}
Truth table0%0/2
A
A= $ENV{'DECC$FILENAME_UNIX_REPORT'}
Aresult
11
00
41 0 ▶ my $efs_charset = $ENV{'DECC$EFS_CHARSET'} || '';
Condition0%0/2
$ENV{'DECC$EFS_CHARSET'} || ''
l!l
00
MC/DC0%0/1
$ENV{'DECC$EFS_CHARSET'} || ''
$ENV{'DECC$EFS_CHARSET'}
Truth table0%0/2
A
A= $ENV{'DECC$EFS_CHARSET'}
Aresult
11
00
42 0 ▶ my $efs_case = $ENV{'DECC$EFS_CASE_PRESERVE'} || '';
Condition0%0/2
$ENV{'DECC$EFS_CASE_PRESERVE'} || ''
l!l
00
MC/DC0%0/1
$ENV{'DECC$EFS_CASE_PRESERVE'} || ''
$ENV{'DECC$EFS_CASE_PRESERVE'}
Truth table0%0/2
A
A= $ENV{'DECC$EFS_CASE_PRESERVE'}
Aresult
11
00
43 0 $vms_unix_rpt = $unix_rpt =~ /^[ET1]/i;
44 0 $vms_efs = $efs_charset =~ /^[ET1]/i;
45 0 $vms_case = $efs_case =~ /^[ET1]/i;
46 }
47 0 ▶ $Is_VMS_lc = 0 if ($vms_case);
Branch: 1 branch
BranchTrueFalseTotal
if $vms_case 0 0 0
48 0 ▶ $Is_VMS_mode = 0 if ($vms_unix_rpt);
Branch: 1 branch
BranchTrueFalseTotal
if $vms_unix_rpt 0 0 0
49 0 ▶ $Is_VMS_nodot = 0 if ($vms_efs);
Branch: 1 branch
BranchTrueFalseTotal
if $vms_efs 0 0 0
50 }
51  
52 1 ▶our $Debug = $ENV{PERL_MM_MANIFEST_DEBUG} || 0;
Condition50%1/2
$ENV{'PERL_MM_MANIFEST_DEBUG'} || 0
l!l
01
MC/DC0%0/1
$ENV{'PERL_MM_MANIFEST_DEBUG'} || 0
$ENV{'PERL_MM_MANIFEST_DEBUG'}
Truth table50%1/2
A
A= $ENV{'PERL_MM_MANIFEST_DEBUG'}
Aresult
11
00
53 our $Verbose = defined $ENV{PERL_MM_MANIFEST_VERBOSE} ?
54 1 ▶ $ENV{PERL_MM_MANIFEST_VERBOSE} : 1;
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'PERL_MM_MANIFEST_VERBOSE'} ? : 1 0 1
55 1 our $Quiet = 0;
56 1 our $MANIFEST = 'MANIFEST';
57  
58 1 our $DEFAULT_MSKIP = File::Spec->rel2abs(File::Spec->catfile( dirname(__FILE__), "$MANIFEST.SKIP" ));
59  
60  
61 =head1 NAME
62  
63 ExtUtils::Manifest - Utilities to write and check a MANIFEST file
64  
65 =head1 VERSION
66  
67 version 1.75
68  
69 =head1 SYNOPSIS
70  
71 use ExtUtils::Manifest qw(...funcs to import...);
72  
73 mkmanifest();
74  
75 my @missing_files = manicheck;
76 my @skipped = skipcheck;
77 my @extra_files = filecheck;
78 my($missing, $extra) = fullcheck;
79  
80 my $found = manifind();
81  
82 my $manifest = maniread();
83  
84 manicopy($read,$target);
85  
86 maniadd({$file => $comment, ...});
87  
88  
89 =head1 DESCRIPTION
90  
91 ...
92  
93 =head1 FUNCTIONS
94  
95 ExtUtils::Manifest exports no functions by default. The following are
96 exported on request:
97  
98 =head2 mkmanifest
99  
100 mkmanifest();
101  
102 Writes all files in and below the current directory to your F<MANIFEST>.
103 It works similar to the result of the Unix command
104  
105 find . > MANIFEST
106  
107 All files that match any regular expression in a file F<MANIFEST.SKIP>
108 (if it exists) are ignored.
109  
110 Any existing F<MANIFEST> file will be saved as F<MANIFEST.bak>.
111  
112 =cut
113  
114 31 ▶sub _sort {
Subroutine _sort: called CC=1 SCAR=0.0
115 31 return sort { lc $a cmp lc $b } @_;
116 }
117  
118 4 ▶sub mkmanifest {
Subroutine mkmanifest: called CC=18 SCAR=29.2
Pod documented
119 4 my $manimiss = 0;
120 4 ▶ my $read = (-r 'MANIFEST' && maniread()) or $manimiss++;
Branch: 1 branch
BranchTrueFalseTotal
my $read = -r "MANIFEST" && maniread() or ++$manimiss 3 1 4
Condition66%2/3
-r 'MANIFEST' && maniread()
!ll&&!rl&&r
103
MC/DC50%1/2
-r 'MANIFEST' && maniread()
-r 'MANIFEST' maniread()
Truth table66%2/3
A && B
A= -r 'MANIFEST'B= maniread()
ABresult
0X0
100
111
121 4 ▶ $read = {} if $manimiss;
Branch: 1 branch
BranchTrueFalseTotal
if $manimiss 1 3 4
122 4 my $bakbase = $MANIFEST;
123 4 ▶ $bakbase =~ s/\./_/g if $Is_VMS_nodot; # avoid double dots
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::Manifest::Is_VMS_nodot 0 4 4
124 4 ▶ rename $MANIFEST, "$bakbase.bak" unless $manimiss;
Branch: 1 branch
BranchTrueFalseTotal
unless $manimiss 3 1 4
125 4 ▶ open my $fh, '>', $MANIFEST or die "Could not open $MANIFEST: $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, ">", $ExtUtils::Manifest::MANIFEST or die "Could not open $ExtUtils::Manifest::MANIFEST: $!" 4 0 4
126 4 binmode $fh, ':raw';
127 4 my $skip = maniskip();
128 4 my $found = manifind();
129 4 my($key,$val,$file,%all);
130 4 %all = (%$found, %$read);
131 4 ▶ $all{$MANIFEST} = ($Is_VMS_mode ? "$MANIFEST\t\t" : '') .
Branch: 2 branches
BranchTrueFalseTotal
if $manimiss 1 3 4
$ExtUtils::Manifest::Is_VMS_mode ? : 0 1 1
132 'This list of files'
133 if $manimiss; # add new MANIFEST to known file list
134 4 foreach $file (_sort keys %all) {
135 38 ▶ if ($skip->($file)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$skip($file)) 12 26 38
136 # Policy: only remove files if they're listed in MANIFEST.SKIP.
137 # Don't remove files just because they don't exist.
138 12 ▶ warn "Removed from $MANIFEST: $file\n" if $Verbose and exists $read->{$file};
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::Manifest::Verbose and exists $read->{$file} 10 2 12
Condition66%2/3
$ExtUtils::Manifest::Verbose and exists $read->{$file}
!ll&&!rl&&r
0210
MC/DC50%1/2
$ExtUtils::Manifest::Verbose and exists $read->{$file}
$ExtUtils::Manifest::Verbose exists $read->{$file}
Truth table66%2/3
A and B
A= $ExtUtils::Manifest::VerboseB= exists $read->{$file}
ABresult
0X0
100
111
139 12 next;
140 }
141 26 ▶ if ($Verbose){
Branch: 1 branch
BranchTrueFalseTotal
if ($ExtUtils::Manifest::Verbose) 26 0 26
142 26 ▶ warn "Added to $MANIFEST: $file\n" unless exists $read->{$file};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $read->{$file} 17 9 26
143 }
144 26 my $text = $all{$file};
145 26 my $tabs = (5 - (length($file)+1)/8);
146 26 ▶ $tabs = 1 if $tabs < 1;
Branch: 1 branch
BranchTrueFalseTotal
if $tabs < 1 0 26 26
147 26 ▶ $tabs = 0 unless $text;
Branch: 1 branch
BranchTrueFalseTotal
unless $text 23 3 26
148 26 ▶ if ($file =~ /\s/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($file =~ /\s/) 2 24 26
149 2 $file =~ s/([\\'])/\\$1/g;
150 2 $file = "'$file'";
151 }
152 26 print $fh $file, "\t" x $tabs, $text, "\n";
153 }
154 }
155  
156 # Geez, shouldn't this use File::Spec or File::Basename or something?
157 # Why so careful about dependencies?
158 128 ▶sub clean_up_filename {
Subroutine clean_up_filename: called CC=4 SCAR=21.7
Pod undocumented
159 128 my $filename = shift;
160 128 $filename =~ s|^\./||;
161 128 ▶ if ( $Is_VMS ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ExtUtils::Manifest::Is_VMS) 0 128 128
162 0 $filename =~ s/\.$//; # trim trailing dot
163 0 $filename = VMS::Filespec::unixify($filename); # unescape spaces, etc.
164 0 ▶ if( $Is_VMS_lc ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ExtUtils::Manifest::Is_VMS_lc) 0 0 0
165 0 $filename = lc($filename);
166 0 ▶ $filename = uc($filename) if $filename =~ /^MANIFEST(\.SKIP)?$/i;
Branch: 1 branch
BranchTrueFalseTotal
if $filename =~ /^MANIFEST(\.SKIP)?$/i 0 0 0
167 }
168 }
169 128 return $filename;
170 }
171  
172  
173 =head2 manifind
174  
175 my $found = manifind();
176  
177 returns a hash reference. The keys of the hash are the files found
178 below the current directory.
179  
180 =cut
181  
182 16 ▶sub manifind {
Subroutine manifind: called CC=2 SCAR=7.0
Pod documented
183 16 ▶ my $p = shift || {};
Condition50%1/2
shift() || {}
l!l
016
MC/DC0%0/1
shift() || {}
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
184 16 my $found = {};
185  
186 128 ▶ my $wanted = sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
187 128 my $name = clean_up_filename($File::Find::name);
188 128 ▶ warn "Debug: diskfile $name\n" if $Debug;
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::Manifest::Debug 0 128 128
189 128 ▶ return if -d $_;
Branch: 1 branch
BranchTrueFalseTotal
if -d $_ 31 97 128
190 97 $found->{$name} = "";
191 16 };
192  
193 # We have to use "$File::Find::dir/$_" in preprocess, because
194 # $File::Find::name is unavailable.
195 # Also, it's okay to use / here, because MANIFEST files use Unix-style
196 # paths.
197 16 find({wanted => $wanted, follow_fast => 1}, ".");
198  
199 16 return $found;
200 }
201  
202  
203 =head2 manicheck
204  
205 my @missing_files = manicheck();
206  
207 checks if all the files within a C<MANIFEST> in the current directory
208 really do exist. If C<MANIFEST> and the tree below the current
209 directory are in sync it silently returns an empty list.
210 Otherwise it returns a list of files which are listed in the
211 C<MANIFEST> but missing from the directory, and by default also
212 outputs these names to STDERR.
213  
214 =cut
215  
216 2 ▶sub manicheck {
Subroutine manicheck: called CC=1 SCAR=0.0
Pod documented
217 2 return _check_files();
218 }
219  
220  
221 =head2 filecheck
222  
223 my @extra_files = filecheck();
224  
225 finds files below the current directory that are not mentioned in the
226 C<MANIFEST> file. An optional file C<MANIFEST.SKIP> will be
227 consulted. Any file matching a regular expression in such a file will
228 not be reported as missing in the C<MANIFEST> file. The list of any
229 extraneous files found is returned, and by default also reported to
230 STDERR.
231  
232 =cut
233  
234 3 ▶sub filecheck {
Subroutine filecheck: called CC=1 SCAR=0.0
Pod documented
235 3 return _check_manifest();
236 }
237  
238  
239 =head2 fullcheck
240  
241 my($missing, $extra) = fullcheck();
242  
243 does both a manicheck() and a filecheck(), returning then as two array
244 refs.
245  
246 =cut
247  
248 0 ▶sub fullcheck {
Subroutine fullcheck: not called CC=1 SCAR=6.9
Pod documented
249 0 return [_check_files()], [_check_manifest()];
250 }
251  
252  
253 =head2 skipcheck
254  
255 my @skipped = skipcheck();
256  
257 lists all the files that are skipped due to your C<MANIFEST.SKIP>
258 file.
259  
260 =cut
261  
262 6 ▶sub skipcheck {
Subroutine skipcheck: called CC=4 SCAR=13.9
Pod documented
263 6 my($p) = @_;
264 6 my $found = manifind();
265 6 my $matches = maniskip();
266  
267 6 my @skipped = ();
268 6 foreach my $file (_sort keys %$found){
269 38 ▶ if (&$matches($file)){
Branch: 1 branch
BranchTrueFalseTotal
if (&$matches($file)) 14 24 38
270 14 ▶ warn "Skipping $file\n" unless $Quiet;
Branch: 1 branch
BranchTrueFalseTotal
unless $ExtUtils::Manifest::Quiet 14 0 14
271 14 push @skipped, $file;
272 14 next;
273 }
274 }
275  
276 6 return @skipped;
277 }
278  
279  
280 2 ▶sub _check_files {
Subroutine _check_files: called CC=8 SCAR=27.7
281 2 my $p = shift;
282 2 ▶ my $dosnames=(defined(&Dos::UseLFN) && Dos::UseLFN()==0);
Condition33%1/3
defined &Dos::UseLFN && Dos::UseLFN() == 0
!ll&&!rl&&r
200
MC/DC0%0/2
defined &Dos::UseLFN && Dos::UseLFN() == 0
defined &Dos::UseLFN Dos::UseLFN() == 0
Truth table33%1/3
A && B
A= defined &Dos::UseLFNB= Dos::UseLFN() == 0
ABresult
0X0
100
111
283 2 ▶ my $read = maniread() || {};
Condition50%1/2
maniread() || {}
l!l
20
MC/DC0%0/1
maniread() || {}
maniread()
Truth table50%1/2
A
A= maniread()
Aresult
11
00
284 2 my $found = manifind($p);
285  
286 2 my(@missfile) = ();
287 2 foreach my $file (_sort keys %$read){
288 3 ▶ warn "Debug: manicheck checking from $MANIFEST $file\n" if $Debug;
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::Manifest::Debug 0 3 3
289 3 ▶ if ($dosnames){
Branch: 1 branch
BranchTrueFalseTotal
if ($dosnames) 0 3 3
290 0 $file = lc $file;
291 0 $file =~ s=(\.(\w|-)+)=substr ($1,0,4)=ge;
292 0 $file =~ s=((\w|-)+)=substr ($1,0,8)=ge;
293 }
294 3 ▶ unless ( exists $found->{$file} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $found->{$file}) 0 3 3
295 0 ▶ warn "No such file: $file\n" unless $Quiet;
Branch: 1 branch
BranchTrueFalseTotal
unless $ExtUtils::Manifest::Quiet 0 0 0
296 0 push @missfile, $file;
297 }
298 }
299  
300 2 return @missfile;
301 }
302  
303  
304 3 ▶sub _check_manifest {
Subroutine _check_manifest: called CC=7 SCAR=19.5
305 3 my($p) = @_;
306 3 ▶ my $read = maniread() || {};
Condition50%1/2
maniread() || {}
l!l
30
MC/DC0%0/1
maniread() || {}
maniread()
Truth table50%1/2
A
A= maniread()
Aresult
11
00
307 3 my $found = manifind($p);
308 3 my $skip = maniskip();
309  
310 3 my @missentry = ();
311 3 foreach my $file (_sort keys %$found){
312 9 ▶ next if $skip->($file);
Branch: 1 branch
BranchTrueFalseTotal
if &$skip($file) 1 8 9
313 8 ▶ warn "Debug: manicheck checking from disk $file\n" if $Debug;
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::Manifest::Debug 0 8 8
314 8 ▶ unless ( exists $read->{$file} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $read->{$file}) 2 6 8
315 2 ▶ warn "Not in $MANIFEST: $file\n" unless $Quiet;
Branch: 1 branch
BranchTrueFalseTotal
unless $ExtUtils::Manifest::Quiet 1 1 2
316 2 push @missentry, $file;
317 }
318 }
319  
320 3 return @missentry;
321 }
322  
323  
324 =head2 maniread
325  
326 my $manifest = maniread();
327 my $manifest = maniread($manifest_file);
328  
329 reads a named C<MANIFEST> file (defaults to C<MANIFEST> in the current
330 directory) and returns a HASH reference with files being the keys and
331 comments being the values of the HASH. Blank lines and lines which
332 start with C<#> in the C<MANIFEST> file are discarded.
333  
334 =cut
335  
336 38 ▶sub maniread {
Subroutine maniread: called CC=13 SCAR=35.0
Pod documented
337 38 my ($mfile) = @_;
338 38 ▶ $mfile ||= $MANIFEST;
Condition33%1/3
$mfile ||= $ExtUtils::Manifest::MANIFEST
l!l&&r!l&&!r
0380
MC/DC0%0/2
$mfile ||= $ExtUtils::Manifest::MANIFEST
$mfile $ExtUtils::Manifest::MANIFEST
Truth table33%1/3
A ||= B
A= $mfileB= $ExtUtils::Manifest::MANIFEST
ABresult
1X1
011
000
339 38 my $read = {};
340 38 my $fh;
341 38 ▶ unless (open $fh, '<', $mfile){
Branch: 1 branch
BranchTrueFalseTotal
unless (open $fh, "<", $mfile) 1 37 38
342 1 warn "Problem opening $mfile: $!";
343 1 return $read;
344 }
345 37 local $_;
346 37 ▶ while (<$fh>){
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 199 37 236
347 199 chomp;
348 199 ▶ next if /^\s*#/;
Branch: 1 branch
BranchTrueFalseTotal
if /^\s*#/ 0 199 199
349  
350 199 my($file, $comment);
351  
352 # filename may contain spaces if enclosed in ''
353 # (in which case, \\ and \' are escapes)
354 199 ▶ if (($file, $comment) = /^'((?:\\[\\']|.+)+)'\s*(.*)/) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = /^'((?:\\[\\']|.+)+)'\s*(.*)/) { } 37 162 199
355 37 $file =~ s/\\([\\'])/$1/g;
356 }
357 else {
358 162 ($file, $comment) = /^(\S+)\s*(.*)/;
359 }
360 199 ▶ next unless $file;
Branch: 1 branch
BranchTrueFalseTotal
unless $file 0 199 199
361  
362 199 ▶ if ($Is_VMS_mode) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ExtUtils::Manifest::Is_VMS_mode) 0 199 199
363 0 require File::Basename;
364 0 my($base,$dir) = File::Basename::fileparse($file);
365 # Resolve illegal file specifications in the same way as tar
366 0 ▶ if ($Is_VMS_nodot) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ExtUtils::Manifest::Is_VMS_nodot) 0 0 0
367 0 $dir =~ tr/./_/;
368 0 my(@pieces) = split(/\./,$base);
369 0 ▶ if (@pieces > 2)
Branch: 1 branch
BranchTrueFalseTotal
if (@pieces > 2) 0 0 0
370 0 { $base = shift(@pieces) . '.' . join('_',@pieces); }
371 0 my $okfile = "$dir$base";
372 0 ▶ warn "Debug: Illegal name $file changed to $okfile\n" if $Debug;
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::Manifest::Debug 0 0 0
373 0 $file = $okfile;
374 }
375 0 ▶ if( $Is_VMS_lc ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ExtUtils::Manifest::Is_VMS_lc) 0 0 0
376 0 $file = lc($file);
377 0 ▶ $file = uc($file) if $file =~ /^MANIFEST(\.SKIP)?$/i;
Branch: 1 branch
BranchTrueFalseTotal
if $file =~ /^MANIFEST(\.SKIP)?$/i 0 0 0
378 }
379 }
380  
381 199 $read->{$file} = $comment;
382 }
383 37 $read;
384 }
385  
386 =head2 maniskip
387  
388 my $skipchk = maniskip();
389 my $skipchk = maniskip($manifest_skip_file);
390  
391 if ($skipchk->($file)) { .. }
392  
393 reads a named C<MANIFEST.SKIP> file (defaults to C<MANIFEST.SKIP> in
394 the current directory) and returns a CODE reference that tests whether
395 a given filename should be skipped.
396  
397 =cut
398  
399 521 ▶sub _process_skipline {
Subroutine _process_skipline: called CC=2 SCAR=7.3
400 521 local $_ = shift;
401 521 chomp;
402 521 s/\r//;
403 521 $_ =~ qr{^\s*(?:(?:'([^\\']*(?:\\.[^\\']*)*)')|([^#\s]\S*))?(?:(?:\s*)|(?:\s+(.*?)\s*))$};
404 #my $comment = $3;
405 521 my $filename = $2;
406 521 ▶ if ( defined($1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $1) 0 521 521
407 0 $filename = $1;
408 0 $filename =~ s/\\(['\\])/$1/g;
409 }
410 521 $filename;
411 }
412  
413 # returns an anonymous sub that decides if an argument matches
414 16 ▶sub maniskip {
Subroutine maniskip: called CC=12 SCAR=25.5
Pod documented
415 16 my @skip ;
416 16 ▶ my $mfile = shift || "$MANIFEST.SKIP";
Condition100%2/2
shift() || "$ExtUtils::Manifest::MANIFEST.SKIP"
l!l
214
MC/DC100%1/1
shift() || "$ExtUtils::Manifest::MANIFEST.SKIP"
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
417 16 ▶ _check_mskip_directives($mfile) if -f $mfile;
Branch: 1 branch
BranchTrueFalseTotal
if -f $mfile 10 6 16
418 16 local $_;
419 16 my $fh;
420 0 ▶ open $fh, '<', $mfile or open $fh, '<', $DEFAULT_MSKIP or return sub {0};
Subroutine __ANON__: not called CC=1 SCAR=0.8
Branch: 1 branch
BranchTrueFalseTotal
open $fh, "<", $mfile or open $fh, "<", $ExtUtils::Manifest::DEFAULT_MSKIP or return sub { 0; } 16 0 16
Condition66%2/3
open $fh, "<", $mfile or open $fh, "<", $ExtUtils::Manifest::DEFAULT_MSKIP
l!l&&r!l&&!r
1060
MC/DC0%0/2
open $fh, "<", $mfile or open $fh, "<", $ExtUtils::Manifest::DEFAULT_MSKIP
open $fh, "<", $mfile open $fh, "<", $ExtUtils::Manifest::DEFAULT_MSKIP
Truth table66%2/3
A or B
A= open $fh, "<", $mfileB= open $fh, "<", $ExtUtils::Manifest::DEFAULT_MSKIP
ABresult
1X1
011
000
421 16 ▶ while (<$fh>){
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 515 16 531
422 515 ▶ if (/^#!include_default\s*$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^#!include_default\s*$/) 3 512 515
423 3 ▶ if (my @default = _include_mskip_file()) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@default) = _include_mskip_file()) 3 0 3
424 3 ▶ warn "Debug: Including default MANIFEST.SKIP\n" if $Debug;
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::Manifest::Debug 0 3 3
425 3 push @skip, grep $_, map _process_skipline($_), @default;
426 }
427 3 next;
428 }
429 512 ▶ next unless my $filename = _process_skipline($_);
Branch: 1 branch
BranchTrueFalseTotal
unless my $filename = _process_skipline($_) 192 320 512
430 320 push @skip, $filename;
431 }
432 0 ▶ return sub {0} unless (scalar @skip > 0);
Subroutine __ANON__: not called CC=1 SCAR=1.2
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @skip > 0 0 16 16
433  
434 16 ▶ my $opts = $Is_VMS_mode ? '(?i)' : '';
Branch: 1 branch
BranchTrueFalseTotal
$ExtUtils::Manifest::Is_VMS_mode ? : 0 16 16
435  
436 # Make sure each entry is isolated in its own parentheses, in case
437 # any of them contain alternations
438 16 my $regex = join '|', map "(?:$_)", @skip;
439  
440 16 ▶ return sub { $_[0] =~ qr{$opts$regex} };
Subroutine __ANON__: called CC=1 SCAR=0.0
441 }
442  
443 1 ▶sub _get_homedir {
Subroutine _get_homedir: called CC=4 SCAR=17.9
444 1 ▶ $^O eq 'MSWin32' && "$]" < 5.016 ? $ENV{HOME} || $ENV{USERPROFILE} : (glob('~'))[0];
Subroutine BEGIN: called CC=1 SCAR=1.2
Branch: 1 branch
BranchTrueFalseTotal
$^O eq 'MSWin32' && "$]" < 5.016 ? : 0 1 1
Condition16%1/6
$^O eq "MSWin32" and "$]" < "5.016"
!ll&&!rl&&r
100
$ENV{"HOME"} or $ENV{"USERPROFILE"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$^O eq "MSWin32" and "$]" < "5.016"
$^O eq "MSWin32" "$]" < "5.016"
MC/DC0%0/2
$ENV{"HOME"} or $ENV{"USERPROFILE"}
$ENV{"HOME"} $ENV{"USERPROFILE"}
Truth table33%1/3
A and B
A= $^O eq "MSWin32"B= "$]" < "5.016"
ABresult
0X0
100
111
Truth table0%0/3
A or B
A= $ENV{"HOME"}B= $ENV{"USERPROFILE"}
ABresult
1X1
011
000
445 }
446  
447 # checks for the special directives
448 # #!include_default
449 # #!include /path/to/some/manifest.skip
450 # in a custom MANIFEST.SKIP for, for including
451 # the content of, respectively, the default MANIFEST.SKIP
452 # and an external manifest.skip file
453 10 ▶sub _check_mskip_directives {
Subroutine _check_mskip_directives: called CC=11 SCAR=24.9
454 10 my $mfile = shift;
455 10 local $_;
456 10 my $fh;
457 10 my @lines = ();
458 10 my $flag = 0;
459 10 ▶ unless (open $fh, '<', $mfile) {
Branch: 1 branch
BranchTrueFalseTotal
unless (open $fh, "<", $mfile) 0 10 10
460 0 warn "Problem opening $mfile: $!";
461 0 return;
462 }
463 10 ▶ while (<$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 39 10 49
464 39 ▶ if (/^#!include\s+(.*)\s*$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^#!include\s+(.*)\s*$/) 2 37 39
465 2 my $external_file = $1;
466 2 $external_file =~ s{^~/}{_get_homedir().'/'}e;
467 2 ▶ if (my @external = _include_mskip_file($external_file)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@external) = _include_mskip_file($external_file)) 2 0 2
468 2 push @lines, @external;
469 2 ▶ warn "Debug: Including external $external_file\n" if $Debug;
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::Manifest::Debug 0 2 2
470 2 $flag++;
471 }
472 2 next;
473 }
474 37 push @lines, $_;
475 }
476 10 close $fh;
477 10 ▶ return unless $flag;
Branch: 1 branch
BranchTrueFalseTotal
unless $flag 9 1 10
478 1 my $bakbase = $mfile;
479 1 ▶ $bakbase =~ s/\./_/g if $Is_VMS_nodot; # avoid double dots
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::Manifest::Is_VMS_nodot 0 1 1
480 1 rename $mfile, "$bakbase.bak";
481 1 ▶ warn "Debug: Saving original $mfile as $bakbase.bak\n" if $Debug;
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::Manifest::Debug 0 1 1
482 1 ▶ unless (open $fh, '>', $mfile) {
Branch: 1 branch
BranchTrueFalseTotal
unless (open $fh, ">", $mfile) 0 1 1
483 0 warn "Problem opening $mfile: $!";
484 0 return;
485 }
486 1 binmode $fh, ':raw';
487 1 print $fh $_ for (@lines);
488 1 return;
489 }
490  
491 # returns an array containing the lines of an external
492 # manifest.skip file, if given, or $DEFAULT_MSKIP
493 5 ▶sub _include_mskip_file {
Subroutine _include_mskip_file: called CC=5 SCAR=17.4
494 5 ▶ my $mskip = shift || $DEFAULT_MSKIP;
Condition66%2/3
shift() || $ExtUtils::Manifest::DEFAULT_MSKIP
l!l&&r!l&&!r
230
MC/DC0%0/2
shift() || $ExtUtils::Manifest::DEFAULT_MSKIP
shift() $ExtUtils::Manifest::DEFAULT_MSKIP
Truth table66%2/3
A || B
A= shift()B= $ExtUtils::Manifest::DEFAULT_MSKIP
ABresult
1X1
011
000
495 5 ▶ unless (-f $mskip) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-f $mskip) 0 5 5
496 0 warn qq{Included file "$mskip" not found - skipping};
497 0 return;
498 }
499 5 local $_;
500 5 my $fh;
501 5 ▶ unless (open $fh, '<', $mskip) {
Branch: 1 branch
BranchTrueFalseTotal
unless (open $fh, "<", $mskip) 0 5 5
502 0 warn "Problem opening $mskip: $!";
503 0 return;
504 }
505 5 my @lines = ();
506 5 push @lines, "\n#!start included $mskip\n";
507 5 ▶ push @lines, $_ while <$fh>;
Branch: 1 branch
BranchTrueFalseTotal
defined($_ = readline $fh) and do { push @lines, $_ } 5 5 10
508 5 push @lines, "#!end included $mskip\n\n";
509 5 return @lines;
510 }
511  
512 =head2 manicopy
513  
514 manicopy(\%src, $dest_dir);
515 manicopy(\%src, $dest_dir, $how);
516  
517 Copies the files that are the keys in %src to the $dest_dir. %src is
518 typically returned by the maniread() function.
519  
520 manicopy( maniread(), $dest_dir );
521  
522 This function is useful for producing a directory tree identical to the
523 intended distribution tree.
524  
525 $how can be used to specify a different methods of "copying". Valid
526 values are C<cp>, which actually copies the files, C<ln> which creates
527 hard links, and C<best> which mostly links the files but copies any
528 symbolic link to make a tree without any symbolic link. C<cp> is the
529 default.
530  
531 =cut
532  
533 2 ▶sub manicopy {
Subroutine manicopy: called CC=10 SCAR=29.0
Pod documented
534 2 my($read,$target,$how)=@_;
535 2 ▶ croak "manicopy() called without target argument" unless defined $target;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $target 0 2 2
536 2 ▶ $how ||= 'cp';
Condition50%1/2
$how ||= "cp"
l!l
20
MC/DC0%0/1
$how ||= "cp"
$how
Truth table50%1/2
A
A= $how
Aresult
11
00
537 2 require File::Path;
538 2 require File::Basename;
539  
540 2 ▶ $target = VMS::Filespec::unixify($target) if $Is_VMS_mode;
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::Manifest::Is_VMS_mode 0 2 2
541 2 ▶ File::Path::mkpath([ $target ],! $Quiet,$Is_VMS ? undef : 0755);
Branch: 1 branch
BranchTrueFalseTotal
$ExtUtils::Manifest::Is_VMS ? : 0 2 2
542 2 foreach my $file (keys %$read){
543 3 ▶ $file = VMS::Filespec::unixify($file) if $Is_VMS_mode;
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::Manifest::Is_VMS_mode 0 3 3
544 3 ▶ if ($file =~ m!/!) { # Ilya, that hurts, I fear, or maybe not?
Branch: 1 branch
BranchTrueFalseTotal
if ($file =~ m[/]) 0 3 3
545 0 my $dir = File::Basename::dirname($file);
546 0 ▶ $dir = VMS::Filespec::unixify($dir) if $Is_VMS_mode;
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::Manifest::Is_VMS_mode 0 0 0
547 0 ▶ File::Path::mkpath(["$target/$dir"],! $Quiet,$Is_VMS ? undef : 0755);
Branch: 1 branch
BranchTrueFalseTotal
$ExtUtils::Manifest::Is_VMS ? : 0 0 0
548 }
549 3 cp_if_diff($file, "$target/$file", $how);
550 }
551 }
552  
553 3 ▶sub cp_if_diff {
Subroutine cp_if_diff: called CC=13 SCAR=35.7
Pod undocumented
554 3 my($from, $to, $how)=@_;
555 3 ▶ if (! -f $from) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-f $from) 1 2 3
556 1 carp "$from not found";
557 1 return;
558 }
559 2 my($diff) = 0;
560 2 my ($fromfh, $tofh);
561 2 ▶ open($fromfh, '<', $from) or die "Can't read $from: $!\n";
Branch: 1 branch
BranchTrueFalseTotal
open $fromfh, "<", $from or die "Can't read ${from}: $!\n" 2 0 2
562 2 ▶ if (open($tofh, '<', $to)) {
Branch: 1 branch
BranchTrueFalseTotal
if (open $tofh, '<', $to) { } 0 2 2
563 0 local $_;
564 0 ▶ while (<$fromfh>) { $diff++,last if $_ ne <$tofh>; }
Branch: 2 branches
BranchTrueFalseTotal
if (defined($_ = readline $fromfh)) 0 0 0
if $_ ne readline $tofh 0 0 0
565 0 ▶ $diff++ unless eof($tofh);
Branch: 1 branch
BranchTrueFalseTotal
unless eof $tofh 0 0 0
566 0 close $tofh;
567 }
568 2 else { $diff++; }
569 2 close $fromfh;
570 2 ▶ if ($diff) {
Branch: 1 branch
BranchTrueFalseTotal
if ($diff) 2 0 2
571 2 ▶ if (-e $to) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $to) 0 2 2
572 0 ▶ unlink($to) or confess "unlink $to: $!";
Branch: 1 branch
BranchTrueFalseTotal
unlink $to or confess("unlink ${to}: $!") 0 0 0
573 }
574 STRICT_SWITCH: {
575 2 ▶ best($from,$to), last STRICT_SWITCH if $how eq 'best';
Branch: 1 branch
BranchTrueFalseTotal
if $how eq "best" 0 2 2
576 2 ▶ cp($from,$to), last STRICT_SWITCH if $how eq 'cp';
Branch: 1 branch
BranchTrueFalseTotal
if $how eq "cp" 2 0 2
577 0 ▶ ln($from,$to), last STRICT_SWITCH if $how eq 'ln';
Branch: 1 branch
BranchTrueFalseTotal
if $how eq "ln" 0 0 0
578 0 croak("ExtUtils::Manifest::cp_if_diff " .
579 "called with illegal how argument [$how]. " .
580 "Legal values are 'best', 'cp', and 'ln'.");
581 }
582 }
583 }
584  
585 2 ▶sub cp {
Subroutine cp: called CC=2 SCAR=7.0
Pod undocumented
586 2 my ($srcFile, $dstFile) = @_;
587 2 my ($access,$mod) = (stat $srcFile)[8,9];
588  
589 2 copy($srcFile,$dstFile);
590 2 ▶ utime $access, $mod + ($Is_VMS ? 1 : 0), $dstFile;
Branch: 1 branch
BranchTrueFalseTotal
$ExtUtils::Manifest::Is_VMS ? : 0 2 2
591 2 _manicopy_chmod($srcFile, $dstFile);
592 }
593  
594  
595 0 ▶sub ln {
Subroutine ln: not called CC=5 SCAR=34.0
Pod undocumented
596 0 my ($srcFile, $dstFile) = @_;
597 # Fix-me - VMS can support links.
598 0 ▶ return &cp if $Is_VMS or ($^O eq 'MSWin32' and Win32::IsWin95());
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::Manifest::Is_VMS or $^O eq "MSWin32" and Win32::IsWin95() 0 0 0
Condition0%0/6
$ExtUtils::Manifest::Is_VMS or $^O eq "MSWin32" and Win32::IsWin95()
l!l&&r!l&&!r
000
$^O eq "MSWin32" and Win32::IsWin95()
!ll&&!rl&&r
000
MC/DC0%0/3
$ExtUtils::Manifest::Is_VMS or $^O eq "MSWin32" and Win32::IsWin95()
$ExtUtils::Manifest::Is_VMS $^O eq "MSWin32" Win32::IsWin95()
Truth table0%0/4
A or B and C
A= $ExtUtils::Manifest::Is_VMSB= $^O eq "MSWin32"C= Win32::IsWin95()
ABCresult
1XX1
0111
00X0
0100
599 0 link($srcFile, $dstFile);
600  
601 0 ▶ unless( _manicopy_chmod($srcFile, $dstFile) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (_manicopy_chmod($srcFile, $dstFile)) 0 0 0
602 0 unlink $dstFile;
603 0 return;
604 }
605 0 1;
606 }
607  
608 # 1) Strip off all group and world permissions.
609 # 2) Let everyone read it.
610 # 3) If the owner can execute it, everyone can.
611 2 ▶sub _manicopy_chmod {
Subroutine _manicopy_chmod: called CC=2 SCAR=6.9
612 2 my($srcFile, $dstFile) = @_;
613  
614 2 my $perm = 0444 | (stat $srcFile)[2] & 0700;
615 2 ▶ chmod( $perm | ( $perm & 0100 ? 0111 : 0 ), $dstFile );
Branch: 1 branch
BranchTrueFalseTotal
$perm & 64 ? : 1 1 2
616 }
617  
618 # Files that are often modified in the distdir. Don't hard link them.
619 1 my @Exceptions = qw(MANIFEST META.yml SIGNATURE);
620 0 ▶sub best {
Subroutine best: not called CC=5 SCAR=34.0
Pod undocumented
621 0 my ($srcFile, $dstFile) = @_;
622  
623 0 my $is_exception = grep $srcFile =~ /$_/, @Exceptions;
624 0 ▶ if ($is_exception or !$Config{d_link} or -l $srcFile) {
Branch: 1 branch
BranchTrueFalseTotal
if ($is_exception or not $ExtUtils::Manifest::Config{'d_link'} or -l $srcFile) { } 0 0 0
Condition0%0/6
$is_exception or not $ExtUtils::Manifest::Config{"d_link"} or -l $srcFile
l!l&&r!l&&!r
000
$is_exception or not $ExtUtils::Manifest::Config{"d_link"}
l!l&&r!l&&!r
000
MC/DC0%0/3
$is_exception or not $ExtUtils::Manifest::Config{"d_link"} or -l $srcFile
$is_exception not $ExtUtils::Manifest::Config{"d_link"} -l $srcFile
Truth table0%0/4
A or not(B) or C
A= $is_exceptionB= not $ExtUtils::Manifest::Config{"d_link"}C= -l $srcFile
ABCresult
1XX1
01X1
0011
0000
625 0 cp($srcFile, $dstFile);
626 } else {
627 0 ▶ ln($srcFile, $dstFile) or cp($srcFile, $dstFile);
Branch: 1 branch
BranchTrueFalseTotal
ln($srcFile, $dstFile) or cp($srcFile, $dstFile) 0 0 0
628 }
629 }
630  
631 =head2 maniadd
632  
633 maniadd({ $file => $comment, ...});
634  
635 Adds an entry to an existing F<MANIFEST> unless its already there.
636  
637 $file will be normalized (ie. Unixified). B<UNIMPLEMENTED>
638  
639 =cut
640  
641 18 ▶sub maniadd {
Subroutine maniadd: called CC=7 SCAR=19.5
Pod documented
642 18 my($additions) = shift;
643  
644 18 _normalize($additions);
645 18 _fix_manifest($MANIFEST);
646  
647 18 my $manifest = maniread();
648 18 my @needed = grep !exists $manifest->{$_}, keys %$additions;
649 18 ▶ return 1 unless @needed;
Branch: 1 branch
BranchTrueFalseTotal
unless @needed 1 17 18
650  
651 17 ▶ open(my $fh, '>>', $MANIFEST) or
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, ">>", $ExtUtils::Manifest::MANIFEST or die "maniadd() could not open $ExtUtils::Manifest::MANIFEST: $!" 16 1 17
652 die "maniadd() could not open $MANIFEST: $!";
653 16 binmode $fh, ':raw';
654  
655 16 foreach my $file (_sort @needed) {
656 20 ▶ my $comment = $additions->{$file} || '';
Condition100%2/2
$additions->{$file} || ''
l!l
146
MC/DC100%1/1
$additions->{$file} || ''
$additions->{$file}
Truth table100%2/2
A
A= $additions->{$file}
Aresult
11
00
657 20 ▶ if ($file =~ /\s/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($file =~ /\s/) 9 11 20
658 9 $file =~ s/([\\'])/\\$1/g;
659 9 $file = "'$file'";
660 }
661 20 printf $fh "%-40s %s\n", $file, $comment;
662 }
663 16 ▶ close $fh or die "Error closing $MANIFEST: $!";
Branch: 1 branch
BranchTrueFalseTotal
close $fh or die "Error closing $ExtUtils::Manifest::MANIFEST: $!" 16 0 16
664  
665 16 return 1;
666 }
667  
668  
669 # Make sure this MANIFEST is consistently written with native
670 # newlines and has a terminal newline.
671 18 ▶sub _fix_manifest {
Subroutine _fix_manifest: called CC=10 SCAR=23.1
672 18 my $manifest_file = shift;
673  
674 18 ▶ open my $fh, '<', $MANIFEST or die "Could not open $MANIFEST: $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "<", $ExtUtils::Manifest::MANIFEST or die "Could not open $ExtUtils::Manifest::MANIFEST: $!" 18 0 18
675 18 local $/;
676 18 my @manifest = split /(\015\012|\012|\015)/, <$fh>, -1;
677 18 close $fh;
678 18 my $must_rewrite = "";
679 18 ▶ if ($manifest[-1] eq ""){
Branch: 1 branch
BranchTrueFalseTotal
if ($manifest[-1] eq '') { } 17 1 18
680 # sane case: last line had a terminal newline
681 17 pop @manifest;
682 17 ▶ for (my $i=1; $i<=$#manifest; $i+=2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#manifest) 97 15 112
683 97 ▶ unless ($manifest[$i] eq "\n") {
Branch: 1 branch
BranchTrueFalseTotal
unless ($manifest[$i] eq "\n") 2 95 97
684 2 $must_rewrite = "not a newline at pos $i";
685 2 last;
686 }
687 }
688 } else {
689 1 $must_rewrite = "last line without newline";
690 }
691  
692 18 ▶ if ( $must_rewrite ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($must_rewrite) 3 15 18
693 3 ▶ 1 while unlink $MANIFEST; # avoid multiple versions on VMS
Branch: 1 branch
BranchTrueFalseTotal
unlink $ExtUtils::Manifest::MANIFEST and do { '???' } 3 3 6
694 3 ▶ open $fh, ">", $MANIFEST or die "(must_rewrite=$must_rewrite) Could not open >$MANIFEST: $!";
Branch: 1 branch
BranchTrueFalseTotal
open $fh, ">", $ExtUtils::Manifest::MANIFEST or die "(must_rewrite=$must_rewrite) Could not open >$ExtUtils::Manifest::MANIFEST: $!" 3 0 3
695 3 binmode $fh, ':raw';
696 3 ▶ for (my $i=0; $i<=$#manifest; $i+=2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#manifest) 7 3 10
697 7 print $fh "$manifest[$i]\n";
698 }
699 3 ▶ close $fh or die "could not write $MANIFEST: $!";
Branch: 1 branch
BranchTrueFalseTotal
close $fh or die "could not write $ExtUtils::Manifest::MANIFEST: $!" 3 0 3
700 }
701 }
702  
703  
704 # UNIMPLEMENTED
705 18 ▶sub _normalize {
Subroutine _normalize: called CC=1 SCAR=0.0
706 18 return;
707 }
708  
709 =head2 MANIFEST
710  
711 A list of files in the distribution, one file per line. The MANIFEST
712 always uses Unix filepath conventions even if you're not on Unix. This
713 means F<foo/bar> style not F<foo\bar>.
714  
715 Anything between white space and an end of line within a C<MANIFEST>
716 file is considered to be a comment. Any line beginning with # is also
717 a comment. Beginning with ExtUtils::Manifest 1.52, a filename may
718 contain whitespace characters if it is enclosed in single quotes; single
719 quotes or backslashes in that filename must be backslash-escaped.
720  
721 # this a comment
722 some/file
723 some/other/file comment about some/file
724 'some/third file' comment
725  
726  
727 =head2 MANIFEST.SKIP
728  
729 The file MANIFEST.SKIP may contain regular expressions of files that
730 should be ignored by mkmanifest() and filecheck(). The regular
731 expressions should appear one on each line. Blank lines and lines
732 which start with C<#> are skipped. Use C<\#> if you need a regular
733 expression to start with a C<#>.
734  
735 For example:
736  
737 # Version control files and dirs.
738 \bRCS\b
739 \bCVS\b
740 ,v$
741 \B\.svn\b
742  
743 # Makemaker generated files and dirs.
744 ^MANIFEST\.
745 ^Makefile$
746 ^blib/
747 ^MakeMaker-\d
748  
749 # Temp, old and emacs backup files.
750 ~$
751 \.old$
752 ^#.*#$
753 ^\.#
754  
755 If no MANIFEST.SKIP file is found, a default set of skips will be
756 used, similar to the example above. If you want nothing skipped,
757 simply make an empty MANIFEST.SKIP file.
758  
759 In one's own MANIFEST.SKIP file, certain directives
760 can be used to include the contents of other MANIFEST.SKIP
761 files. At present two such directives are recognized.
762  
763 =over 4
764  
765 =item #!include_default
766  
767 This tells ExtUtils::Manifest to read the default F<MANIFEST.SKIP>
768 file and skip files accordingly, but I<not> to include it in the local
769 F<MANIFEST.SKIP>. This is intended to skip files according to a system
770 default, which can change over time without requiring further changes
771 to the distribution's F<MANIFEST.SKIP>.
772  
773 =item #!include /Path/to/another/manifest.skip
774  
775 This inserts the contents of the specified external file in the local
776 F<MANIFEST.SKIP>. This is intended for authors to have a central
777 F<MANIFEST.SKIP> file, and to include it with their various distributions.
778  
779 =back
780  
781 The included contents will be inserted into the MANIFEST.SKIP
782 file in between I<#!start included /path/to/manifest.skip>
783 and I<#!end included /path/to/manifest.skip> markers.
784 The original MANIFEST.SKIP is saved as MANIFEST.SKIP.bak.
785  
786 =head2 EXPORT_OK
787  
788 C<&mkmanifest>, C<&manicheck>, C<&filecheck>, C<&fullcheck>,
789 C<&maniread>, and C<&manicopy> are exportable.
790  
791 =head2 GLOBAL VARIABLES
792  
793 C<$ExtUtils::Manifest::MANIFEST> defaults to C<MANIFEST>. Changing it
794 results in both a different C<MANIFEST> and a different
795 C<MANIFEST.SKIP> file. This is useful if you want to maintain
796 different distributions for different audiences (say a user version
797 and a developer version including RCS).
798  
799 C<$ExtUtils::Manifest::Quiet> defaults to 0. If set to a true value,
800 all functions act silently.
801  
802 C<$ExtUtils::Manifest::Debug> defaults to 0. If set to a true value,
803 or if PERL_MM_MANIFEST_DEBUG is true, debugging output will be
804 produced.
805  
806 =head1 DIAGNOSTICS
807  
808 All diagnostic output is sent to C<STDERR>.
809  
810 =over 4
811  
812 =item C<Not in MANIFEST:> I<file>
813  
814 is reported if a file is found which is not in C<MANIFEST>.
815  
816 =item C<Skipping> I<file>
817  
818 is reported if a file is skipped due to an entry in C<MANIFEST.SKIP>.
819  
820 =item C<No such file:> I<file>
821  
822 is reported if a file mentioned in a C<MANIFEST> file does not
823 exist.
824  
825 =item C<MANIFEST:> I<$!>
826  
827 is reported if C<MANIFEST> could not be opened.
828  
829 =item C<Added to MANIFEST:> I<file>
830  
831 is reported by mkmanifest() if $Verbose is set and a file is added
832 to MANIFEST. $Verbose is set to 1 by default.
833  
834 =back
835  
836 =head1 ENVIRONMENT
837  
838 =over 4
839  
840 =item B<PERL_MM_MANIFEST_DEBUG>
841  
842 Turns on debugging
843  
844 =back
845  
846 =head1 SEE ALSO
847  
848 L<ExtUtils::MakeMaker> which has handy targets for most of the functionality.
849  
850 =head1 AUTHOR
851  
852 Andreas Koenig C<andreas.koenig@anima.de>
853  
854 Currently maintained by the Perl Toolchain Gang.
855  
856 =head1 COPYRIGHT AND LICENSE
857  
858 This software is copyright (c) 1996- by Andreas Koenig.
859  
860 This is free software; you can redistribute it and/or modify it under
861 the same terms as the Perl 5 programming language system itself.
862  
863 =cut
864  
865 1 1;
↑ Summary