in reply to Re: nested subs cause DESTROY block to not get hit
in thread nested subs cause DESTROY block to not get hit

Unlike C++, an object destructor is nearly never needed in Perl, and even when it is, explicit invocation is uncalled for. In the case of our Person class, we don't need a destructor because Perl takes care of simple matters like memory deallocation.
I quite disagree. GC is great for memory, but doesn't do a thing for other resources such as window handles. If an object represents a window, the object being destructed closes the window. Do you want the window to stay visible until the system notices it can collect it, or promptly when the last reference is dropped?

  • Comment on Re: Re: nested subs cause DESTROY block to not get hit

Replies are listed 'Best First'.
Re: Re: Re: nested subs cause DESTROY block to not get hit
by Monky Python (Scribe) on Aug 17, 2001 at 01:25 UTC
    hmmm... but I also don't want to destruct the object just to close the window.
    IMHO the destructor of the object should call the destroy/close function of the window and thats it....
    but it seems we are getting of topic ,)

    MP