[Melbourne-pm] TK repeats, scoping and keeping track of objects

Matthew Robinson matt at zensunni.org
Mon Jan 12 18:51:47 PST 2009

Hi Leigh,

Leigh Sharpe wrote:
> Here's the bit I couldn't quite understand. My::Class::DESTROY() is not
> called when the 'Exit' button on $tl is clicked. If I click on 'Create
> an object' several times, and close any or all of the windows it
> creates, there is no message printed when the window is closed. Only
> when I click on 'Exit' in the main window, thereby terminating the whole
> program, do I ever see DESTROY() called. And then it's once for every
> object created while the program was running, irrespective of whether
> it's window has been closed or not.  Try it, the above example is
> complete.
I have tried your example on both OSX and Windows and it is giving me 
the required behaviour.  When I click the Exit button on the child 
windows I get a message on the console saying 'fred is being 
destroyed'.  The message isn't always immediate but it does appear as a 
result of clicking the Exit button on the $tl windows.

I was using perl 5.8.8 and Tk 804.028 on the Mac and perl 5.10.0 and Tk 
804.028 on Windows.



More information about the Melbourne-pm mailing list