- or download this
my $comm_tree = Tree::DAG_Node->new; #create the root node
$comm_tree->name('CommentRoot');
my %noderef; #hash of node references, with PID as keys
$noderef{0} = \$comm_tree; #replies to the story have PID==0
- or download this
while ( my $hashref = $query->fetchrow_hashref() ) {
my $tmpref = $noderef{ $$hashref{pid} };
...
$noderef{ $cid } = \$nodeone; #add this node ref to the hash
$comm_hashref{ $cid } = $hashref;
}
- or download this
$comm_tree->walk_down(
{
...
}
);
$template->param(comment_loop => \@comm_loop);