localize %seen instead of resetting it
Yuval Kogman [Sat, 16 Aug 2008 02:15:04 +0000 (02:15 +0000)]
lib/Moose/Exporter.pm

index 1eb8a51..01ed414 100644 (file)
@@ -56,13 +56,13 @@ sub build_import_methods {
 }
 
 {
-    my %seen;
+    my $seen = {};
 
     sub _follow_also {
         my $class             = shift;
         my $exporting_package = shift;
 
-        %seen = ( $exporting_package => 1 );
+        local %$seen = ( $exporting_package => 1 );
 
         return uniq( _follow_also_real($exporting_package) );
     }
@@ -82,9 +82,9 @@ sub build_import_methods {
         for my $package (@also)
         {
             die "Circular reference in also parameter to MooseX::Exporter between $exporting_package and $package"
-                if $seen{$package};
+                if $seen->{$package};
 
-            $seen{$package} = 1;
+            $seen->{$package} = 1;
         }
 
         return @also, map { _follow_also_real($_) } @also;