Since the child is initialized with the attribute values of the parents, it "inherits" a reference to the tied variable, so parent and child share the same data. Untieing one is untieing the other.
Hope this helps, -gjb-
| [reply] |
So that would involve untieing the $self->{data} in the child class, but NOT untieing it in the parent class? That's the only way I imagine it would work, but I don't know how to do that (how to prevent calling the parent's DESTROY() method. If both parent's and child's DESTROY() methods are called, the parent's DESTROY() method still overwrited the tied data with its copy as opposed to updated child's data.
Maybe I'm just trying to do something that doesn't really have to be done. I just want to know if I'm going all wrong about the whole thing.
| [reply] |
| [reply] [d/l] [select] |
I reckon you only need to untie and destroy the object once - if the data's shared then updating the child's data updates the parent's data automatically.
By the sounds of it, you don't need to worry about DESTROY in the child - just call the parent module's DESTROY and let it take care of the untieing of the object and the DB update.
Hope that helps .. -- Foxcub
| [reply] [d/l] [select] |