Click here to get back home

the use of removeChild() in Tree::Simple

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
the use of removeChild() in Tree::Simple Lovingu.McDull 06-23-2007
Posted by Lovingu.McDull on June 23, 2007, 8:18 am
Please log in for more thread options


I am currently using Tree::Simple module.

I originally have a tree x. My task is to insert a node G into x, so
that the B node under A go under G.

My solution is: I create G first, then G->addChild(B). then disconnect
B from A, finally A->addChild(G).

x:
A
/ \
B E...
/\ |
C D F...
y:
A
/ \
G E...
| |
B F...
/\
C D
But it seems the disconnection can't be achieved by using
removeChild(), according to the specification,
"When a child is removed, it results in the shifting up of all
children after it, and the removed child is returned."
That is, if i delete B from x, the tree will look like this. It is
difficult for me to A->addChild(G) to this intermediate tree.
A
/ \ \
C D E...
|
F...

Any suggestions? //P.S. I prefer a solution in which the nodes are
relocated rather than being removed and regenerated.


Similar ThreadsPosted
[RFC] XML::Simple::Tree November 3, 2005, 11:37 pm
Class::Tree V 1.24 July 29, 2004, 7:15 am
a problem using Tree::DAG_Node? December 9, 2004, 2:44 pm
html interface to a data tree December 14, 2004, 7:24 am
querying modules dependency tree on CPAN November 19, 2004, 1:54 am
HTML::Element->right/->look_down lose, I need to walk the tree June 20, 2005, 9:56 am
XML::Simple Help? April 23, 2005, 5:09 pm
Help in XML::Simple July 1, 2005, 9:12 pm
Getopt::Simple V 1.47 July 29, 2004, 7:18 am
Simple question September 15, 2005, 4:17 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap