In perl.git, the branch maint-5.10 has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/6c13a57c5f6ea13b95dccb8f70eab139cff818f3?hp=27a65de2e2197b9a3754e51a45403dc08f65ae7e>

- Log -----------------------------------------------------------------
commit 6c13a57c5f6ea13b95dccb8f70eab139cff818f3
Author: Nicholas Clark <[email protected]>
Date:   Sat Jun 13 11:02:45 2009 +0100

    FindBin doesn't need to use Config;
    
    (cherry picked from commit 5abfb2931ef91f04be263e7109374961f3094f4e)

M       lib/FindBin.pm

commit 20c1e4ac7593418f8606a222c250c5d38b7cfcfe
Author: Nicholas Clark <[email protected]>
Date:   Sat Jun 13 20:09:47 2009 +0100

    Improve perlmodlib.PL. Reduce the amount of special case logic.
    Get the module name from the Pod, rather than using heuristics on the 
filename
    (sometimes wrong). Parse .pm_PL files too. Special cases now are only Config
    and 8 files that don't use their package name in =head NAME.
    
    (cherry picked from commit cf9cbb1fcbe6c43ec204ccc0203775f22364127c)

M       pod/perlmodlib.PL
-----------------------------------------------------------------------

Summary of changes:
 lib/FindBin.pm    |    3 +-
 pod/perlmodlib.PL |   83 ++++++++++++++++++-----------------------------------
 2 files changed, 29 insertions(+), 57 deletions(-)

diff --git a/lib/FindBin.pm b/lib/FindBin.pm
index e218de9..892d6e5 100644
--- a/lib/FindBin.pm
+++ b/lib/FindBin.pm
@@ -96,7 +96,6 @@ use Carp;
 require 5.000;
 require Exporter;
 use Cwd qw(getcwd cwd abs_path);
-use Config;
 use File::Basename;
 use File::Spec;
 
@@ -104,7 +103,7 @@ use File::Spec;
 %EXPORT_TAGS = (ALL => [qw($Bin $Script $RealBin $RealScript $Dir $RealDir)]);
 @ISA = qw(Exporter);
 
-$VERSION = "1.49";
+$VERSION = "1.50";
 
 
 # needed for VMS-specific filename translation
diff --git a/pod/perlmodlib.PL b/pod/perlmodlib.PL
index 0a75208..99fca65 100644
--- a/pod/perlmodlib.PL
+++ b/pod/perlmodlib.PL
@@ -8,44 +8,27 @@ chdir $FindBin::Bin or die "$0: Can't chdir $FindBin::Bin: 
$!";
 my $Quiet = @ARGV && $ARGV[0] eq '-q';
 
 open (OUT, ">perlmodlib.pod") or die $!;
-my (@pragma, @mod, @MANIFEST);
+my (@pragma, @mod, @files);
 
 # MANIFEST itself is Unix style filenames, so we have to assume that Unix style
 # filenames will work.
 
 open (MANIFEST, "../MANIFEST") or die $!;
-...@manifest = grep !m</(?:t|demo)/>, <MANIFEST>;
-push @MANIFEST, 'lib/Config.pod', 'lib/Errno.pm', 'lib/lib.pm',
-    'lib/DynaLoader.pm', 'lib/XSLoader.pm';
-
-# If run in a clean source tree, these will be missing because they are
-# generated by the build.
-my %generated = (
-    'encoding' => 'Allows you to write your script in non-ascii or non-utf8',
-    'lib' => 'Manipulate @INC at compile time',
-    'ops' => 'Restrict unsafe operations when compiling',
-    'Config' => 'Access Perl configuration information',
-    'DynaLoader' => 'Dynamically load C libraries into Perl code',
-    'Errno' => 'System errno constants',
-    'O' => 'Generic interface to Perl Compiler backends',
-    'Safe' => 'Compile and execute code in restricted compartments',
-    'XSLoader' => 'Dynamically load C libraries into Perl code',
+...@files = grep m#(?:\.pm|\.pod|_pm\.PL)#, map {s/\s.*//s; $_}
+    grep {m#^lib# || m#^ext#} grep !m#/(?:t|demo)/#, <MANIFEST>;
+
+my %exceptions = (
+    'abbrev' => 'Text::Abbrev',
+    'carp' => 'Carp',
+    'getopt' => 'Getopt::Std',
+    'B<CGI::Carp>' => 'CGI::Carp',
+    'ModuleInfo' => 'Module::Build::ModuleInfo',
+    '$notes_name' => 'Module::Build::Notes',
+    'Encode::MIME::NAME' => 'Encode::MIME::Name',
+    'libnetFAQ' => 'Net::libnetFAQ',
 );
 
-# If run in a clean source tree, these should not be reported.
-# These are considered 'modules' by this script, but they really are not.
-my %suppressed = map {$_ => 1} qw(
-    B::O
-    Encode::encoding
-    Opcode::Safe
-    Opcode::ops
-);
-
-for (@MANIFEST) {
-    my $filename;
-    next unless m|^lib/| or m|^ext/|;
-    my ($filename) = m|^(\S+)|;
-    next unless $filename =~ m!\.p(m|od)$!;
+for my $filename (@files) {
     unless (open MOD, '<', "../$filename") {
        warn "Couldn't open ../$filename: $!";
        next;
@@ -71,16 +54,6 @@ for (@MANIFEST) {
      chomp($title);
      close MOD;
 
-     my $perlname = $filename;
-     $perlname =~ s!^.*\b(ext|lib)/!!;
-     $perlname =~ s!\.p(m|od)$!!;
-     $perlname =~ s!\b(\w+)/\1\b!$1!;
-     $perlname =~ s!/!::!g;
-     $perlname =~ s!-!::!g;
-
-     # modules with non standard locations
-     $perlname =~ s{Base64::QuotedPrint}{QuotedPrint};
-
      ($name, $thing) = split / --? /, $title, 2;
 
      unless ($name and $thing) {
@@ -89,30 +62,30 @@ for (@MANIFEST) {
          next;
      }
 
-     next if $suppressed{$perlname};
-
+     $name =~ s/[^A-Za-z0-9_:\$<>].*//;
+     $name = $exceptions{$name} || $name;
      $thing =~ s/^perl pragma to //i;
      $thing = ucfirst($thing);
-     $title = "=item $perlname\n\n$thing\n\n";
+     $title = "=item $name\n\n$thing\n\n";
 
-     if ($filename =~ /[A-Z]/) {
+     if ($name =~ /[A-Z]/) {
           push @mod, $title;
      } else {
           push @pragma, $title;
      }
 
-     # if we find a generated one via the MANIFEST, no need to add later.
-     delete $generated{$perlname};
-}
-while (my ($name,$desc) = each %generated) {
-    my $title = "=item $name\n\n$desc\n\n";
-    if ($name =~ /[A-Z]/) {
-        push @mod, $title;
-    } else {
-        push @pragma, $title;
-    }
 }
 
+# Much easier to special case it like this than special case the depending on
+# and parsing lib/Config.pod, or special case opening configpm and finding its
+# =head1 (which is not found with the $/="" above)
+push @mod, <<'CONFIG';
+=item Config
+
+Access Perl configuration information
+
+CONFIG
+
 print OUT <<'EOF';
 =for maintainers
 Generated by perlmodlib.PL -- DO NOT EDIT!

--
Perl5 Master Repository

Reply via email to