http://www.perlmonks.org?node_id=1061508


in reply to Re: perl 5.16.3 + Tk 804.031 core dumps on syntax check when a window is made in BEGIN block
in thread perl 5.16.3 + Tk 804.031 core dumps on syntax check when a window is made in BEGIN block

Earlier use Tk; was already in BEGIN block before the genesis of above test case.

Moving destroy() inside BEGIN does avoid the core dump. Need to have, however, the MainWindow object to live beyond BEGIN block for other things.

# Remove "BEGIN" and get no core dump. BEGIN { use Tk; our $MW = MainWindow->new(); # other method calls. } our $MW; # more changes to the window. # Being here does not avoid core dump. $MW->destroy();
c