is_duplicate_pod() and get_pod_metadata() in pod_lib.pl modified $_
authorNicholas Clark <nick@ccl4.org>
Tue, 7 Feb 2012 16:18:36 +0000 (17:18 +0100)
committerNicholas Clark <nick@ccl4.org>
Tue, 7 Feb 2012 16:18:36 +0000 (17:18 +0100)
Reported by Reini Urban in RT #110078, installperl generated a warning and
failed to install CORE.pod, because is_duplicate_pod() modified $_
is_duplicate_pod() and get_pod_metadata() now both localise $_, to ensure
that they don't corrupt any caller's state.

Porting/pod_lib.pl

index c86993d..98c32f4 100644 (file)
@@ -86,6 +86,7 @@ my %state = (
 
     sub is_duplicate_pod {
         my $file = shift;
+        local $_;
 
         # Initialise the list of possible source files on the first call.
         unless (%Lengths) {
@@ -229,6 +230,7 @@ sub get_pod_metadata {
     my $permit_missing_generated = shift;
     # Do they want a consistency report?
     my $callback = shift;
+    local $_;
 
     __prime_state() unless $state{master};
     return \%state unless $callback;