A missed check-in.
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / Manifest.pm
index 1a6dde7..46ace64 100644 (file)
@@ -4,11 +4,12 @@ require Exporter;
 use Config;
 use File::Find;
 use File::Copy 'copy';
+use File::Spec::Functions qw(splitpath);
 use Carp;
 use strict;
 
 use vars qw($VERSION @ISA @EXPORT_OK
-           $Is_VMS $Debug $Verbose $Quiet $MANIFEST $found);
+           $Is_VMS $Debug $Verbose $Quiet $MANIFEST $found $DEFAULT_MSKIP);
 
 $VERSION = substr(q$Revision: 1.33 $, 10);
 @ISA=('Exporter');
@@ -18,13 +19,15 @@ $VERSION = substr(q$Revision: 1.33 $, 10);
 $Is_VMS = $^O eq 'VMS';
 if ($Is_VMS) { require File::Basename }
 
-$Debug = 0;
+$Debug = $ENV{PERL_MM_MANIFEST_DEBUG} || 0;
 $Verbose = 1;
 $Quiet = 0;
 $MANIFEST = 'MANIFEST';
+$DEFAULT_MSKIP = (splitpath($INC{"ExtUtils/Manifest.pm"}))[1]."$MANIFEST.SKIP";
 
 # Really cool fix from Ilya :)
 unless (defined $Config{d_link}) {
+    no warnings;
     *ln = \&cp;
 }
 
@@ -159,8 +162,7 @@ sub _maniskip {
     my @skip ;
     $mfile ||= "$MANIFEST.SKIP";
     local *M;
-    return $matches unless -f $mfile;
-    open M, $mfile or return $matches;
+    open M, $mfile or open M, $DEFAULT_MSKIP or return $matches;
     while (<M>){
        chomp;
        next if /^#/;
@@ -186,14 +188,13 @@ sub manicopy {
     require File::Basename;
     my(%dirs,$file);
     $target = VMS::Filespec::unixify($target) if $Is_VMS;
-    umask 0 unless $Is_VMS;
-    File::Path::mkpath([ $target ],1,$Is_VMS ? undef : 0755);
+    File::Path::mkpath([ $target ],! $Quiet,$Is_VMS ? undef : 0755);
     foreach $file (keys %$read){
        $file = VMS::Filespec::unixify($file) if $Is_VMS;
        if ($file =~ m!/!) { # Ilya, that hurts, I fear, or maybe not?
            my $dir = File::Basename::dirname($file);
            $dir = VMS::Filespec::unixify($dir) if $Is_VMS;
-           File::Path::mkpath(["$target/$dir"],1,$Is_VMS ? undef : 0755);
+           File::Path::mkpath(["$target/$dir"],! $Quiet,$Is_VMS ? undef : 0755);
        }
        cp_if_diff($file, "$target/$file", $how);
     }
@@ -238,7 +239,7 @@ sub cp {
 
 sub ln {
     my ($srcFile, $dstFile) = @_;
-    return &cp if $Is_VMS;
+    return &cp if $Is_VMS or ($^O eq 'MSWin32' and Win32::IsWin95());
     link($srcFile, $dstFile);
     local($_) = $dstFile; # chmod a+r,go-w+X (except "X" only applies to u=x)
     my $mode= 0444 | (stat)[2] & 0700;
@@ -268,27 +269,27 @@ ExtUtils::Manifest - utilities to write and check a MANIFEST file
 
 =head1 SYNOPSIS
 
-C<require ExtUtils::Manifest;>
+    require ExtUtils::Manifest;
 
-C<ExtUtils::Manifest::mkmanifest;>
+    ExtUtils::Manifest::mkmanifest;
 
-C<ExtUtils::Manifest::manicheck;>
+    ExtUtils::Manifest::manicheck;
 
-C<ExtUtils::Manifest::filecheck;>
+    ExtUtils::Manifest::filecheck;
 
-C<ExtUtils::Manifest::fullcheck;>
+    ExtUtils::Manifest::fullcheck;
 
-C<ExtUtils::Manifest::skipcheck;>
+    ExtUtils::Manifest::skipcheck;
 
-C<ExtUtild::Manifest::manifind();>
+    ExtUtils::Manifest::manifind();
 
-C<ExtUtils::Manifest::maniread($file);>
+    ExtUtils::Manifest::maniread($file);
 
-C<ExtUtils::Manifest::manicopy($read,$target,$how);>
+    ExtUtils::Manifest::manicopy($read,$target,$how);
 
 =head1 DESCRIPTION
 
-Mkmanifest() writes all files in and below the current directory to a
+mkmanifest() writes all files in and below the current directory to a
 file named in the global variable $ExtUtils::Manifest::MANIFEST (which
 defaults to C<MANIFEST>) in the current directory. It works similar to
 
@@ -302,33 +303,33 @@ comments are separated by one or more TAB characters in the
 output. All files that match any regular expression in a file
 C<MANIFEST.SKIP> (if such a file exists) are ignored.
 
-Manicheck() checks if all the files within a C<MANIFEST> in the
+manicheck() checks if all the files within a C<MANIFEST> in the
 current directory really do exist. It only reports discrepancies and
 exits silently if MANIFEST and the tree below the current directory
 are in sync.
 
-Filecheck() finds files below the current directory that are not
+filecheck() finds files below the current directory that are not
 mentioned in the C<MANIFEST> file. An optional file C<MANIFEST.SKIP>
 will be consulted. Any file matching a regular expression in such a
 file will not be reported as missing in the C<MANIFEST> file.
 
-Fullcheck() does both a manicheck() and a filecheck().
+fullcheck() does both a manicheck() and a filecheck().
 
-Skipcheck() lists all the files that are skipped due to your
+skipcheck() lists all the files that are skipped due to your
 C<MANIFEST.SKIP> file.
 
-Manifind() returns a hash reference. The keys of the hash are the
+manifind() returns a hash reference. The keys of the hash are the
 files found below the current directory.
 
-Maniread($file) reads a named C<MANIFEST> file (defaults to
+maniread($file) reads a named C<MANIFEST> file (defaults to
 C<MANIFEST> in the current directory) and returns a HASH reference
 with files being the keys and comments being the values of the HASH.
 Blank lines and lines which start with C<#> in the C<MANIFEST> file
 are discarded.
 
-I<Manicopy($read,$target,$how)> copies the files that are the keys in
+C<manicopy($read,$target,$how)> copies the files that are the keys in
 the HASH I<%$read> to the named target directory. The HASH reference
-I<$read> is typically returned by the maniread() function. This
+$read is typically returned by the maniread() function. This
 function is useful for producing a directory tree identical to the
 intended distribution tree. The third parameter $how can be used to
 specify a different methods of "copying". Valid values are C<cp>,
@@ -344,15 +345,27 @@ expressions should appear one on each line. Blank lines and lines
 which start with C<#> are skipped.  Use C<\#> if you need a regular
 expression to start with a sharp character. A typical example:
 
+    # Version control files and dirs.
     \bRCS\b
+    \bCVS\b
+    ,v$
+
+    # Makemaker generated files and dirs.
     ^MANIFEST\.
     ^Makefile$
-    ~$
-    \.html$
-    \.old$
     ^blib/
     ^MakeMaker-\d
 
+    # Temp, old and emacs backup files.
+    ~$
+    \.old$
+    ^#.*#$
+
+If no MANIFEST.SKIP file is found, a default set of skips will be
+used, similar to the example above.  If you want nothing skipped,
+simply make an empty MANIFEST.SKIP file.
+
+
 =head1 EXPORT_OK
 
 C<&mkmanifest>, C<&manicheck>, C<&filecheck>, C<&fullcheck>,
@@ -369,6 +382,10 @@ and a developer version including RCS).
 C<$ExtUtils::Manifest::Quiet> defaults to 0. If set to a true value,
 all functions act silently.
 
+C<$ExtUtils::Manifest::Debug> defaults to 0.  If set to a true value,
+or if PERL_MM_MANIFEST_DEBUG is true, debugging output will be
+produced.
+
 =head1 DIAGNOSTICS
 
 All diagnostic output is sent to C<STDERR>.
@@ -397,12 +414,22 @@ to MANIFEST. $Verbose is set to 1 by default.
 
 =back
 
+=head1 ENVIRONMENT
+
+=over 4
+
+=item B<PERL_MM_MANIFEST_DEBUG>
+
+Turns on debugging
+
+=back
+
 =head1 SEE ALSO
 
 L<ExtUtils::MakeMaker> which has handy targets for most of the functionality.
 
 =head1 AUTHOR
 
-Andreas Koenig <F<koenig@franz.ww.TU-Berlin.DE>>
+Andreas Koenig <F<andreas.koenig@anima.de>>
 
 =cut