http://qs1969.pair.com?node_id=67647


in reply to Re (tilly) 1: Reverse Inheritance Irritance
in thread Reverse Inheritance Irritance

Inheritance is indeed overused and proxying is often a good way to work around it. The downside to that is that it eats up more memory, and runs slower.

While that is usually not bigger and slower enough to be truly detering, in some cases (mostly when you have potentially *lots* of object, for instance in a DOM tree) though it's clearly counter-indicated. I've been planning for a while to look into the ex::interface module on CPAN which is supposed to allow for interface inheritance but I haven't found the time at moments when my brain is in a good enough state :-/

PS: do you still have the code that made DESTROY not turn up in AUTOLOAD ? It should really be called explicitly... a code construct that doesn't force one to check for that would be interesting.

-- darobin

  • Comment on Re: Re (tilly) 1: Reverse Inheritance Irritance

Replies are listed 'Best First'.
Re (tilly) 3: Reverse Inheritance Irritance
by tilly (Archbishop) on Mar 28, 2001 at 09:03 UTC
    I was seriously confused about this. After a bit of debugging I figured it out though. Here is a simple example that shows what is going on:
    my $test = sub {bless {}}; $test->(); $test->(); $test->(); sub DESTROY { print "Calling DESTROY\n"; die "But you won't see this message\n"; }
    See it?

    DESTROY is called in an eval. Since my code was only putting out output within a confess, that output was trapped. So I saw nothing, the script kept on going, and I thought that DESTROY wasn't being called. When in fact it is...

    Mystery solved. :-)