Skip to content

Commit 055ddfd

Browse files
mohawk2kentfredric
authored andcommitted
Doc, implement #!include_default as memory-only, not changing file.
1 parent a9ae00a commit 055ddfd

File tree

2 files changed

+30
-19
lines changed

2 files changed

+30
-19
lines changed

Changes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Revision history for ExtUtils-Manifest
22

33
{{$NEXT}}
4+
- #!include_default now memory-only, not changing MANIFEST.SKIP file.
45

56
1.72 2019-03-10
67
- also skip META_new.* (thanks, brian d foy!)

lib/ExtUtils/Manifest.pm

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,20 @@ a given filename should be skipped.
404404
405405
=cut
406406
407+
sub _process_skipline {
408+
local $_ = shift;
409+
chomp;
410+
s/\r//;
411+
$_ =~ qr{^\s*(?:(?:'([^\\']*(?:\\.[^\\']*)*)')|([^#\s]\S*))?(?:(?:\s*)|(?:\s+(.*?)\s*))$};
412+
#my $comment = $3;
413+
my $filename = $2;
414+
if ( defined($1) ) {
415+
$filename = $1;
416+
$filename =~ s/\\(['\\])/$1/g;
417+
}
418+
$filename;
419+
}
420+
407421
# returns an anonymous sub that decides if an argument matches
408422
sub maniskip {
409423
my @skip ;
@@ -412,16 +426,14 @@ sub maniskip {
412426
local(*M, $_);
413427
open M, "< $mfile" or open M, "< $DEFAULT_MSKIP" or return sub {0};
414428
while (<M>){
415-
chomp;
416-
s/\r//;
417-
$_ =~ qr{^\s*(?:(?:'([^\\']*(?:\\.[^\\']*)*)')|([^#\s]\S*))?(?:(?:\s*)|(?:\s+(.*?)\s*))$};
418-
#my $comment = $3;
419-
my $filename = $2;
420-
if ( defined($1) ) {
421-
$filename = $1;
422-
$filename =~ s/\\(['\\])/$1/g;
429+
if (/^#!include_default\s*$/) {
430+
if (my @default = _include_mskip_file()) {
431+
warn "Debug: Including default MANIFEST.SKIP\n" if $Debug;
432+
push @skip, grep $_, map _process_skipline($_), @default;
433+
}
434+
next;
423435
}
424-
next if (not defined($filename) or not $filename);
436+
next unless my $filename = _process_skipline($_);
425437
push @skip, _macify($filename);
426438
}
427439
close M;
@@ -452,14 +464,6 @@ sub _check_mskip_directives {
452464
return;
453465
}
454466
while (<M>) {
455-
if (/^#!include_default\s*$/) {
456-
if (my @default = _include_mskip_file()) {
457-
push @lines, @default;
458-
warn "Debug: Including default MANIFEST.SKIP\n" if $Debug;
459-
$flag++;
460-
}
461-
next;
462-
}
463467
if (/^#!include\s+(.*)\s*$/) {
464468
my $external_file = $1;
465469
if (my @external = _include_mskip_file($external_file)) {
@@ -809,11 +813,17 @@ files. At present two such directives are recognized.
809813
810814
=item #!include_default
811815
812-
This inserts the contents of the default MANIFEST.SKIP file
816+
This tells ExtUtils::Manifest to read the default F<MANIFEST.SKIP>
817+
file and skip files accordingly, but I<not> to include it in the local
818+
F<MANIFEST.SKIP>. This is intended to skip files according to a system
819+
default, which can change over time without requiring further changes
820+
to the distribution's F<MANIFEST.SKIP>.
813821
814822
=item #!include /Path/to/another/manifest.skip
815823
816-
This inserts the contents of the specified external file
824+
This inserts the contents of the specified external file in the local
825+
F<MANIFEST.SKIP>. This is intended for authors to have a central
826+
F<MANIFEST.SKIP> file, and to include it with their various distributions.
817827
818828
=back
819829

0 commit comments

Comments
 (0)