Home: Perl Programming Help: Win32 Programming Help:
Can't call method "STORE" on an undefined value during global destruction



PapaGeek
User

Feb 12, 2014, 8:13 AM


Views: 19974
Can't call method "STORE" on an undefined value during global destruction

Im getting this error message when I close a WIN32::GUI program with the X in the window frame.


I found some old posts from 2011 on this problem, but no solution was offered, other than to insinuate that the bug was reported.

Does anyone know of a solution to this issue?

The code is just a skeleton of the GUI I want for my current project. The logic so far is just moving between and closing windows. The code to close everything with the X on the top menu is:


Code
sub TheTopMenu_Terminate { 
print "Top Menu X Hit\n";
return -1;
}


The other menus work with either the button or the X. The top menu displays the Top Menu X Hit trace line and then the Can't call method "STORE" on an undefined value during global destruction. Error message.

Again, this is just a rough rough first step at designing the GUI.

Here is the all of the code Im running that gets the error message when you hit the X on the top menu:




Code
use Modern::Perl '2013'; 

use Win32::GUI();

my $popUpWindow;

my $TopMenu;
my $MonthlyMenu;
my $ViewMenu;
my $InvestMenu;
my $FundMenu;

my $TimesRoman20;
my $TopMenuWidth;
my $TopMenuHeight;
my $screen_width;
my $screen_height;

main();


sub main
{
my $TopMenuWidth = 335;
my $TopMenuHeight = 250;
my $screen_width = Win32::GUI::GetSystemMetrics(0);
my $screen_height = Win32::GUI::GetSystemMetrics(1);
$TimesRoman20 = Win32::GUI::Font->new(
-name => "Times New Roman",
-size => 20,
-bold => 1,
);
$TopMenu = new Win32::GUI::Window(
-name => "TheTopMenu",
-title => "Main Window",
-pos => [ ($screen_width - $TopMenuWidth)/2,
($screen_height - $TopMenuHeight)/2 ],
-size => [ $TopMenuWidth, $TopMenuHeight ],
-background => [128,255,128],
);

$TopMenu->AddButton(
-name => "OpenMonthly",
-text => "Run Monthly Reports",
-pos => [ 10, 10 ],
-align => "center",
-valign => "center",
-size => [ 300, 40],
-font => $TimesRoman20,
);

$TopMenu->AddButton(
-name => "OpenView",
-text => "View Monthly Reports",
-pos => [ 10, 60 ],
-align => "center",
-valign => "center",
-size => [ 300, 40],
-font => $TimesRoman20,
);
$TopMenu->AddButton(
-name => "OpenInvestments",
-text => "Manage Investments",
-pos => [ 10, 110 ],
-align => "center",
-valign => "center",
-size => [ 300, 40],
-font => $TimesRoman20,
);
$TopMenu->AddButton(
-name => "OpenFunds",
-text => "Manage Funds",
-pos => [ 10, 160 ],
-align => "center",
-valign => "center",
-size => [ 300, 40],
-font => $TimesRoman20,
);

# Monthly Report Menu

my $MonthlyMenuWidth = 235;
my $MonthlyMenuHeight = 150;

$MonthlyMenu = new Win32::GUI::Window(
-name => "Monthly",
-title => "Running Monthly Reports",
-pos => [ ($screen_width - $MonthlyMenuWidth)/2,
($screen_height - $MonthlyMenuHeight)/2 ],
-size => [ $MonthlyMenuWidth, $MonthlyMenuHeight ],
-background => [172,172,255],
);
$MonthlyMenu->AddButton(
-name => "CloseMonthly",
-text => "Close this window",
-pos => [ 10, 10 ],
);

# View Report Menu

my $ViewMenuWidth = 235;
my $ViewMenuHeight = 150;

$ViewMenu = new Win32::GUI::Window(
-name => "View",
-title => "View Monthly Reports",
-pos => [ ($screen_width - $ViewMenuWidth)/2,
($screen_height - $ViewMenuHeight)/2 ],
-size => [ $ViewMenuWidth, $ViewMenuHeight ],
-background => [255,172,172],
);
$ViewMenu->AddButton(
-name => "CloseView",
-text => "Close this window",
-pos => [ 10, 10 ],
);

# Manage Investments Menu

my $InvestMenuWidth = 235;
my $InvestMenuHeight = 150;

$InvestMenu = new Win32::GUI::Window(
-name => "Invest",
-title => "Running Invest Reports",
-pos => [ ($screen_width - $InvestMenuWidth)/2,
($screen_height - $InvestMenuHeight)/2 ],
-size => [ $InvestMenuWidth, $InvestMenuHeight ],
-background => [204,204,255],
);
$InvestMenu->AddButton(
-name => "CloseInvest",
-text => "Close this window",
-pos => [ 10, 10 ],
);

# Fund Report Menu

my $FundMenuWidth = 235;
my $FundMenuHeight = 150;

$FundMenu = new Win32::GUI::Window(
-name => "Fund",
-title => "Running Fund Reports",
-pos => [ ($screen_width - $FundMenuWidth)/2,
($screen_height - $FundMenuHeight)/2 ],
-size => [ $FundMenuWidth, $FundMenuHeight ],
-background => [204,255,204],
);
$FundMenu->AddButton(
-name => "CloseFund",
-text => "Close this window",
-pos => [ 10, 10 ],
);

$TopMenu->Show();

Win32::GUI::Dialog();
}

sub OpenMonthly_Click {
print "Monthly Button Hit\n";
$MonthlyMenu->Show();
$TopMenu->Hide();
}

sub OpenView_Click {
print "View Button Hit\n";
$ViewMenu->Show();
$TopMenu->Hide();
}

sub OpenInvestments_Click {
print "Investments Button Hit\n";
$InvestMenu->Show();
$TopMenu->Hide();
}

sub OpenFunds_Click {
print "Funds Button Hit\n";
$FundMenu->Show();
$TopMenu->Hide();
}

sub CloseMonthly_Click {
return Monthly_Terminate();
}

sub Monthly_Terminate {
print ("Click Monthly X\n");
$MonthlyMenu->Hide();
$TopMenu->Show();
return 0;
}

sub CloseView_Click {
return Monthly_Terminate();
}

sub View_Terminate {
print ("Click View X\n");
$ViewMenu->Hide();
$TopMenu->Show();
return 0;
}

sub CloseInvest_Click {
return Monthly_Terminate();
}

sub Invest_Terminate {
print ("Click Invest X\n");
$InvestMenu->Hide();
$TopMenu->Show();
return 0;
}

sub CloseFund_Click {
return Monthly_Terminate();
}

sub Fund_Terminate {
print ("Click Fund X\n");
$FundMenu->Hide();
$TopMenu->Show();
return 0;
}


sub TheTopMenu_Terminate {
print "Top Menu X Hit\n";
return -1;
}



FishMonger
Veteran / Moderator

Feb 12, 2014, 12:30 PM


Views: 19961
Re: [PapaGeek] Can't call method "STORE" on an undefined value during global destruction

Looks like there is an open bug report on this issue which was opened back in April 2008. The module was last updated in Feb of 2008.
http://sourceforge.net/p/perl-win32-gui/bugs/75/

It does not appear to be a fatal crash, but you might try emailing the author of the module to see if he will help.
http://search.cpan.org/~robertmay/