On Thu, Oct 16, 2008 at 02:56:28PM +1100, Timothy S. Nelson wrote:
>       Hi all.  I'm working on the code for trees that I keep talking about,  
> and I have code that somewhat resembles the following:
> role  Tree::Node does Array {
>       has Tree::Node @!children handles <Array List Container>;
> }
>       The intent of this code is that, if you treat the Tree::Node as an  
> array, you're operating on its children.  I'm sure there are obvious bugs 
> in that code that I'd be happy to hear about, but my question at the 
> moment is, I want to be able to intercept calls that put things into the 
> array and pull them out, and perform code at that time.  For example, I'd 
> like it if
> $node = Tree::Node->new();
> $othernode = Tree::Node->new();
> $node[0] = $othernode;
>       ...would allow me to operate on $othernode, so that I could ensure that 
> they belong to the same tree, for example.  Is there a way I can do that?

You have to write your own wrapper methods for that.  Delegation does
not mix well with micromanagement.  :)


Reply via email to