[VPM] testing two refs for same target

Peter Scott Peter at PSDT.com
Sat Jul 5 10:22:03 CDT 2003

At 12:15 AM 7/5/2003 -0700, Darren Duncan wrote:
>Actually, if a user is declaring more than once that a node is a child of 
>another, this would likely be considered an error, but it is one that my 
>current input checking routines don't look for.

Ah, then a hash would be ideal:

$child{$obj} ? error("Object is already a child") : ($child{$obj} = $obj);

>  A hash would be ideal except that I am interested in maintaining the 
> order of all the child nodes under a parent.

tie %child, "Tie::IxHash";

>I may probably end up using both an array and a hash which both list the 
>same items, for different reasons.
> >Strange sort of inheritance relationship you've got going there...
>I should clarify that there is technically no inheritence being used 
>here.  All of the "nodes" are each separate objects, all of which are in 
>the same class.

I misspoke. I meant the parent-child relationships you were talking about. 
But we should reserver 'inheritance' for class relationships, so in your 
case it's a container tree, or... someone help me out with the proper term 

>SQL::ObjectModel is conceptually similar to an XML DOM, which has a tree 
>of nodes, except that it is more specialized in its content.  If it were 
>practical to do so I may even change it later to subclass an XML DOM 
>implementation or something.  But I probably won't since I don't need most 
>of the DOM features and they take up space.

Peter Scott
peter at psdt.com

More information about the Victoria-pm mailing list