This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Porting/bump-perl-version: No need to try other maps after one has worked
authorSteve Hay <steve.m.hay@googlemail.com>
Thu, 19 Feb 2015 08:42:46 +0000 (08:42 +0000)
committerSteve Hay <steve.m.hay@googlemail.com>
Sat, 21 Feb 2015 16:52:30 +0000 (16:52 +0000)
Porting/bump-perl-version

index 5654a57..b60e8e3 100644 (file)
@@ -265,6 +265,7 @@ sub do_scan {
 
        while (my $line = <$fh>) {
            my $oldline = $line;
 
        while (my $line = <$fh>) {
            my $oldline = $line;
+           my $line_changed = 0;
            for my $map (@maps) {
                my ($pat, $sub, $expected, $file_pat) = @$map;
 
            for my $map (@maps) {
                my ($pat, $sub, $expected, $file_pat) = @$map;
 
@@ -278,9 +279,13 @@ sub do_scan {
                }
                $line =~ s/$pat/$replacement/
                    or die "Internal error: substitution failed: [$pat]\n";
                }
                $line =~ s/$pat/$replacement/
                    or die "Internal error: substitution failed: [$pat]\n";
+               if ($line ne $oldline) {
+                   $line_changed = 1;
+                   last;
+               }
            }
            $new_contents .= $line if $opts{i};
            }
            $new_contents .= $line if $opts{i};
-           if ($line ne $oldline) {
+           if ($line_changed) {
                $file_changed = 1;
                if ($opts{s}) {
                    print "\n$file\n" unless $header;
                $file_changed = 1;
                if ($opts{s}) {
                    print "\n$file\n" unless $header;