This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In checkcfgvar.pl, eliminate the file-scope lexical %MASTER_CFG.
authorNicholas Clark <nick@ccl4.org>
Tue, 9 Aug 2011 09:47:50 +0000 (11:47 +0200)
committerNicholas Clark <nick@ccl4.org>
Tue, 9 Aug 2011 09:47:50 +0000 (11:47 +0200)
Porting/checkcfgvar.pl

index e8342ea..66787d5 100755 (executable)
@@ -28,7 +28,6 @@ GetOptions (
     ) or usage (1);
 
 my $MASTER_CFG = "config_h.SH";
-my %MASTER_CFG;
 
 my %lst;
 my @CFG = (
@@ -53,16 +52,19 @@ my @CFG = (
           "Porting/config.sh",
          );
 
+my @MASTER_CFG;
 {
+    my %seen;
     open my $fh, '<', $MASTER_CFG;
     while (<$fh>) {
        while (/[^\\]\$([a-z]\w+)/g) {
            my $v = $1;
            next if $v =~ /^(CONFIG_H|CONFIG_SH)$/;
-           $MASTER_CFG{$v}++;
+           $seen{$v}++;
        }
     }
     close $fh;
+    @MASTER_CFG = sort keys %seen;
 }
 
 my %MANIFEST;
@@ -75,8 +77,6 @@ my %MANIFEST;
     close $fh;
 }
 
-my @MASTER_CFG = sort keys %MASTER_CFG;
-
 for my $cfg (@CFG) {
     unless (exists $MANIFEST{$cfg}) {
        print STDERR "[skipping not-expected '$cfg']\n";