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


in reply to Re^2: 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

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

  • Comment on Re^3: perl 5.16.3 + Tk 804.031 core dumps on syntax check when a window is made in BEGIN block
  • Select or Download Code

Replies are listed 'Best First'.
Re^4: 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 09, 2013 at 12:02 UTC
    # 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