this passes all 5 inf loop tests
Brandon L Black [Thu, 9 Nov 2006 22:44:23 +0000 (22:44 +0000)]
lib/Algorithm/C3.pm

index 00250c9..f1d9781 100644 (file)
@@ -48,7 +48,6 @@ sub merge {
             $i = 0;
             next;
         }
-        %seen = ();
 
         my $mergeout = $cache->{merge}->{$current_root} ||= do {
 
@@ -94,6 +93,8 @@ sub merge {
 
         return @$mergeout if !@STACK;
 
+        $seen{$current_root}--;
+
         ($current_root, $current_parents, $recurse_mergeout, $i)
             = @{pop @STACK};