Skip to content

Commit

Permalink
do not revisit seen references
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbs committed Jul 7, 2011
1 parent 6ad9df3 commit 11de4e8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/Class/Rebless.pm
Expand Up @@ -79,7 +79,10 @@ sub _recurse {
#print ">>>> recurse " . Carp::longmess;

my $refaddr = Scalar::Util::refaddr($who);
return if defined $refaddr and $state->{stack}{$refaddr};
if (defined $refaddr) {
return if $state->{stack}{$refaddr};
return if $state->{seen}{$refaddr}++ and ! $opts->{revisit};
}

local $state->{level} = $state->{level} + 1;
local $state->{stack}{ defined $refaddr ? $refaddr : '' } = 1;
Expand Down

0 comments on commit 11de4e8

Please sign in to comment.