Subject: | Bug using includeTrunk with a PreOrderTraversal. |
The includeTrunk() method does not seem to work with the
preOrderTraversal visitor. Specifically, calling IncludeTrunk(1) on your
visitor object ala...
$visitor->includeTrunk(1);
Does not cause the visitor to include the root of the tree in its
traversal.
I managed to fix the issue with with the following change.
In Visitor.pm line 106:
I replaced:
$func->($tree) unless defined $self->{_include_trunk};
with the following lines
if(defined $self->{_include_trunk})
{
if($self->{_include_trunk}){
$func->($tree)
}
}
That seems to fix the issue for me. I haven't tested it
throughly though.
Thanks for the great module. I learned a lot about Perl just
by looking through your code. The way you wrote the $func function
is totally new to me, and just by reading that I learned a great
new programming technique.
- Moses