Gary Holloway wrote:
> Wouldn't it make sense that if there is a MANIFEST.SKIP file that it
> would be honored by libscan() so that files that are to be skipped when
> validating the MANIFEST are also not included in the generated makefile
> rules (e.g., in the definitions of TO_INST_PM, PM_TO_BLIB) or am I
> misunderstanding its purpose?
Scenario: You generate a file but don't want to ship it so you place it into
MANIFEST.SKIP. You still want libscan() to see it.
> An example is temporary vim files (e.g., *.swp). If present, they're
> found by libscan() and included in TO_INST_PM.
In MM_Unix->init_PM() there is code to skip some common editor backup files.
This should do the trick.
--- a/lib/ExtUtils/MM_Unix.pm
+++ b/lib/ExtUtils/MM_Unix.pm
@@ -1501,8 +1501,9 @@ sub init_PM {
return;
}
return if /\#/;
- return if /~$/; # emacs temp files
- return if /,v$/; # RCS files
+ return if /~$/; # emacs temp files
+ return if /,v$/; # RCS files
+ return if m{\.swp$}; # vim swap files
my $path = $File::Find::name;
my $prefix = $self->{INST_LIBDIR};
> The (only?) solution I've come up with is creating my own MY::libscan in
> Makefile.PL that filters the results from the default libscan
> (ExtUtils::MM_any::libscan()) using the regexp's in MAKEFILE.SKIP; like so:
>
> #
> =============================================================================
>
>
> my $skip;
>
> # Exclude any files matching patterns in the MANIFEST.SKIP file from being
> # included in rules in the generated Makefile.
> #
> sub MY::libscan
> {
my $self = shift;
> unless (defined $skip) {
> # Newer versions of ExtUtils define maniskip(); older versions
> (like
> # what we're using now) define _maniskip() -- use whatever is
> # present, preferring the newer, "public", name.
Might be simpler to run skipcheck() and chuck the results into a hash, given
the compatibility issue.
> if (defined(&ExtUtils::Manifest::maniskip )) {
> $skip = ExtUtils::Manifest::maniskip();
> } elsif (defined(&ExtUtils::Manifest::_maniskip)) {
> $skip = ExtUtils::Manifest::_maniskip();
> } else {
> $skip = undef;
> }
> }
>
> my $path = ExtUtils::MM_Any::libscan(@_);
There's no guarantee that libscan() will be in MM_Any or that will be your
parent class, so...
my $path = $self->SUPER::libscan(@_);
> return ($skip && $skip->($path)) ? '' : $path;
> }
--
The past has a vote, but not a veto.
-- Mordecai M. Kaplan