This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Makefile.PL: Fix so works on early perls
authorKarl Williamson <khw@cpan.org>
Tue, 9 Jul 2019 17:40:50 +0000 (11:40 -0600)
committerNicolas R <atoomic@cpan.org>
Fri, 27 Sep 2019 20:36:02 +0000 (14:36 -0600)
You can't declare a variable within a looping statement like 'for' in
early perls.  Just declare it immediately beforehand.

(cherry picked from commit 1b3fbf992bcf862b418afbd705ce1d1eb0c573fb)
Signed-off-by: Nicolas R <atoomic@cpan.org>
dist/Devel-PPPort/Makefile.PL

index 97b02d0..66c4703 100644 (file)
@@ -69,7 +69,8 @@ sub configure
   if (eval { ExtUtils::MakeMaker->VERSION (6.46) }) {
     open FH, '<PPPort_pm.PL' or die "cannot open PPPort_pm.PL for reading: $!";
     my $version;
-    while (my $line = <FH>) {
+    my $line;
+    while ($line = <FH>) {
       ($version) = $line =~ /^\$VERSION = '([\d.]+)';$/ and last;
     };
     die 'failed to extract $VERSION from PPPort_pm.PL' if not $version;
@@ -166,7 +167,8 @@ sub MY::processPL
 
   my $updated = '';
   my @rules = split( m{^\s*$}m, $original );
-  foreach my $rule ( @rules ) {
+  my $rule;
+  foreach $rule ( @rules ) {
     if ( $rule =~ m{^\s*^PPPort\.pm\s+:}m ) {
       $rule =~ s{^(\s*^PPPort\.pm\s+:.*)}{$1 $includes}m; # PPPort.pm depends on all files from parts/inc
       $rule =~ s{pm_to_blib}{}m; # PPPort.pm must not depend on built PPPort.pm in blib/
@@ -193,7 +195,8 @@ sub MY::dist_core
 
   my $updated = '';
   my @rules = split( m{^\s*$}m, $dist );
-  foreach my $rule ( @rules ) {
+  my $rule;
+  foreach $rule ( @rules ) {
     if ( $rule =~ m{^\s*^dist\s+:}m ) {
         $rule =~ s{:}{: manifest}; # make sure we regenerate the manifest
         $rule .= qq[\t].q[$(NOECHO) $(ECHO) "Warning: Please check '__MAX_PERL__' value in PPPort_pm.PL"].qq[\n];