This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Consistent use of whitespace in ?S: and ?C:
[metaconfig.git] / U / mkgloss.pl
index 81b5d5a..346d597 100755 (executable)
@@ -1,6 +1,6 @@
-#!/pro/bin/perl
+#!/usr/bin/perl
 
-# (c)'06 H.Merijn Brand [ 09 Apr 2006 ]
+# (c)'11 H.Merijn Brand [ 26 Aug 2011 ]
 
 # This script combines the output of mkglossary, with the suggested
 # patches (see README), and sorts the list
@@ -8,6 +8,25 @@
 use strict;
 use warnings;
 
+my $Pcsh = "Porting/config.sh";
+@ARGV = "config.sh";
+my @config = <> or die
+    "mkgloss uses $Pcsh.sh. You didn't run Configure (yet)\n".
+    "so I cannot make a temporary version of it to generate a reliable\n".
+    "Glossary!\n";
+{   my $drop = 0;
+    for (@config) {
+       s{\bh.m.brand\@\w+\.nl\b}{hmbrand\@cpan.org};
+       s{\b\.xs4all.nl\b}{.cpan.org};
+       m/^# Variables propagated from previous config/ and $drop++;
+       $drop and $_ = '';
+       }
+    unlink $Pcsh;
+    open my $config, ">", $Pcsh or die "$Pcsh: $!\n";
+    print   $config @config;
+    close   $config;
+    }
+
 @ARGV = ("U/mkglossary |");
 $/ = undef;
 my @g = split m{(?<=\n\n)(?=\S)}, <>, -1;
@@ -28,5 +47,6 @@ for (sort { lc $a cmp lc $b } @g) {
     if (m/^spitshell /) {
        s/cat or a grep -v for # comments/cat or a grep '-v' for # comments/;
        }
+    s/[ \t]+\n/\n/g;
     print;
     }