Fix careless handling of the hinthash in PP mode (RT#73402)
[p5sagit/namespace-clean.git] / lib / namespace / clean.pm
index fbcfeec..1e6d51a 100644 (file)
@@ -80,7 +80,10 @@ EOE
       push @$stack, namespace::clean::_ScopeGuard->arm(shift);
     }
     else {
+      my %old_contents = %^H;
+      %^H = ();
       tie( %^H, 'namespace::clean::_TieHintHash', namespace::clean::_ScopeGuard->arm(shift) );
+      $^H{$_} = $old_contents{$_} for keys %old_contents;
     }
   }