This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Use strict and warnings in win32/config_(s)h.PL
authorSteve Hay <steve.m.hay@googlemail.com>
Thu, 7 Jun 2012 12:36:37 +0000 (13:36 +0100)
committerSteve Hay <steve.m.hay@googlemail.com>
Thu, 7 Jun 2012 12:36:37 +0000 (13:36 +0100)
win32/config_h.PL
win32/config_sh.PL

index dbefeb5..3905e33 100644 (file)
@@ -1,14 +1,17 @@
-#
+#!perl -w
+use strict;
+
 BEGIN { warn "Running ".__FILE__."\n" };
 BEGIN 
  {
   require "Config.pm";
   die "Config.pm:$@" if $@;
-  Config::->import;
+  Config->import;
  }
 use File::Compare qw(compare);
 use File::Copy qw(copy);
 use File::Basename qw(fileparse);
+
 my ($name, $dir) = fileparse($0);
 $name =~ s#^(.*)\.PL$#../$1.SH#;
 my %opt;
@@ -28,7 +31,7 @@ while (<SH>)
  {
   last if /^\s*sed/;
  }
-($term,$file,$pat) = /^\s*sed\s+<<(\S+)\s+>(\S+)\s+(.*)$/;
+my($term,$file,$pat) = /^\s*sed\s+<<(\S+)\s+>(\S+)\s+(.*)$/;
 
 $file =~ s/^\$(\w+)$/$opt{$1}/g;
 
@@ -106,7 +109,7 @@ sub BackTick
  my $cmd = shift;
  if ($cmd =~ /^echo\s+(.*?)\s*\|\s+sed\s+'(.*)'\s*$/)
   {
-   local ($data,$pat) = ($1,$2);
+   my($data,$pat) = ($1,$2);
    $data =~ s/\s+/ /g;
    eval "\$data =~ $pat";
    return $data;
index 7f56025..3fde6ee 100644 (file)
@@ -1,4 +1,7 @@
+#!perl -w
+use strict;
 use FindExt;
+
 # take a semicolon separated path list and turn it into a quoted
 # list of paths that Text::Parsewords will grok
 sub mungepath {
@@ -18,7 +21,7 @@ sub loadopts {
     if ($ARGV[0] =~ /--cfgsh-option-file/) {
        shift @ARGV;
        my $optfile = shift @ARGV;
-       local (*F);
+       local (*OPTF);
        open OPTF, $optfile or die "Can't open $optfile: $!\n";
        my @opts;
        chomp(my $line = <OPTF>);
@@ -136,7 +139,7 @@ if ($opt{useithreads} eq 'define' && $opt{ccflags} =~ /-DPERL_IMPLICIT_SYS\b/) {
 }
 
 while (<>) {
-    s/~([\w_]+)~/$opt{$1}/g;
+    s/~([\w_]+)~/exists $opt{$1} ? $opt{$1} : ''/eg;
     if (/^([\w_]+)=(.*)$/) {
        my($k,$v) = ($1,$2);
        # this depends on cf_time being empty in the template (or we'll