$class->getTree() failed to insert the dummy root into the tree for subclasses

that use a dummy root.

Set the name() method so that draw_ascii_tree() produces something useful
This commit is contained in:
Ben Simpson 2003-05-19 13:56:58 +00:00
parent c954ff636c
commit d3478c8282

View file

@ -239,7 +239,7 @@ sub getTree {
unless (ref($self)) {
if ($class->useDummyRoot()) {
$self = $class->dummyRoot();
$nodes->{0} = $self = $class->dummyRoot();
}
if (!defined($maxDepth)) {
@ -306,6 +306,26 @@ sub minimumFields {
#-------------------------------------------------------------------
sub name {
my $self = shift;
return $self->keyColumn().':'.$self->get($self->keyColumn());
}
#-------------------------------------------------------------------
# Avoid a bug in Tree::DAG_Node.
# When a new node is created and has no daughters. This sometimes causes
# problems for Tree::DAG_Node::walk_down()
sub new {
my $class = shift;
my $self = $class->SUPER::new(@_);
$self->{daughters} ||= [] if $self;
return $self;
}
#-------------------------------------------------------------------
=head2 motherSelfAndSisters( $keyColumnId )
Given the $keyColumnId, this method fetches the related mother and sisters.