in reply to Re: "cleaning out" object data
in thread "cleaning out" object data

I like your thinking, but I'd suggest not calling it init. 'reset' or something similar might be a better idea.

It's common practice, when you're dealing with inheritance, to make sure you call all of the init-type functions in the inherited object. (the easiest way is to just call $self->NEXT::_init(), if you're using NEXT

Of course, if you were to use an _init() function as you've described, you'll end up trashing whatever other people have set up, as well.

Ideally, you would just clear out the keys that you were making use of, so you don't end up treading on someone else's toes... but I'd still move the destructive part of the code out to a seperate function that is not called by the _init() or new() routines.

Replies are listed 'Best First'.
Re^3: "cleaning out" object data
by aukjan (Friar) on May 20, 2005 at 13:53 UTC
    Thanks for pointing out $self->NEXT::... to me... I have not been doing too much OO, but I have encountered problems for which the NEXT module is a good option! I will be busy making some code changes now :)

    .:| If it can't be fixed .. Don't break it |:.