in reply to Re: Inheritance and objects tied to a database
in thread Inheritance and objects tied to a database

I tried it and, unless I made some kind of fundamental mistake in my test, it doesn't work. I think when you do something like  $self->Parent::DESTROY(); it just uses the parent's DESTROY() method with child's data. So yes, it would save the changes to the database, but they are going to be almost instantly overwritten with parent's data when the parent's DESTROY() method is executed.

Thanks for trying to help! I'm still confused about the issue though.

Replies are listed 'Best First'.
Re[3]: Inheritance and objects tied to a database
by Tanalis (Curate) on Dec 20, 2002 at 12:48 UTC
    I guess the alternative would be to take the save out of DESTROY, and explicitly save the data to the DB ..?

    That way, a call to, say, $self->Parent::Save would save using the child data, and you can simply bypass the save when the parent is destroyed.

    After all, if no changes are made in the child no save of the parental data should be needed anyway (if I'm reading this right).

    Just a thought ..
    -- Foxcub

      I guess I could do that. It just feels like it's a workaround only applied for the (my) lack of understanding of how to do it correctly with tie() and the inheritance mechanism.