Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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

by Anonymous Monk
on Nov 07, 2013 at 00:37 UTC ( #1061508=note: print w/ replies, xml ) Need Help??


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


Comment on Re^2: perl 5.16.3 + Tk 804.031 core dumps on syntax check when a window is made in BEGIN block
Select or Download Code
Re^3: perl 5.16.3 + Tk 804.031 core dumps on syntax check when a window is made in BEGIN block
by MidLifeXis (Prior) on Nov 07, 2013 at 15:09 UTC

    BEGIN { use Tk; our $MW = MainWindow->new(); # other method calls. } our $MW;

    Perhaps you mean (not verified):

    our $MW; BEGIN { use Tk; $MW = MainWindow->new(); # other method calls. }
    Declare the window before the BEGIN block, and assign it within the BEGIN block. Update: I stand corrected.

    --MidLifeXis

      # cat x.pl ; perl-5.16.2 x.pl use strict; use warnings FATAL => 'all'; use 5.010; P::show(); Q::show(); R::show(); {{ package P; my $v = __PACKAGE__; BEGIN { $v .= ' ' . __LINE__; } sub show { say $v; } }} {{ package Q; our $v = __PACKAGE__; BEGIN { $v .= ' ' . __LINE__; } sub show { say $v; } }} {{ package R; BEGIN { our $v = __PACKAGE__ . ' ' . __LINE__; } our $v; sub show { say $v; } }} __END__ 13 21 R 28

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1061508]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2014-10-02 05:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (49 votes), past polls