my ($walk, $ordersub) = @_;
my %seen;
- my $depth = 0;
my @visited;
while ($walk) {
push @visited, $walk;
}
# go down, or across
- if ($child) {
- $next = $child;
- ++$depth;
- }
+ $next = $child if $child;
# no next? look up
if (!$next) {
my $up = $walk;
while ($up && !$next) {
$up = $up->{parent};
- --$depth;
$next = $up->{next} if $up;
}
}