$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:
parent
c954ff636c
commit
d3478c8282
1 changed files with 21 additions and 1 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue