I'm writing an application in Perl/Tk and wanted to include a "Website" button, which when clicked, would open my website in their browser.
I'm using threads to create a separate thread to run the system command, so that the GUI won't freeze until the browser window is opened. Here's my code:
What happens is, the explorer window pops up and goes to the website, all the while without freezing the GUI, but once the page finishes loading, the Perl interpreter gives one of those "Send error report" Windows XP errors. The console says this:
Does Tk try to share widgets between threads automatically, or am I doing something wrong?
I'm using threads to create a separate thread to run the system command, so that the GUI won't freeze until the browser window is opened. Here's my code:
Code:
$btnFrame->Button (
-text => 'Website',
-background => '#000000',
-foreground => '#EEEEEE',
-activeforeground => '#00FFFF',
-activebackground => '#000000',
-command => sub {
&website();
},
)->pack (-padx => 10);
sub website {
my $t = threads->new ( sub {
system ("start [URL unfurl="true"]http://azulian.f2mb.com/");[/URL]
});
$t->detach;
}
What happens is, the explorer window pops up and goes to the website, all the while without freezing the GUI, but once the page finishes loading, the Perl interpreter gives one of those "Send error report" Windows XP errors. The console says this:
Code:
Attempt to free non-existent shared string '_TK_RESULT_', Perl interpreter: 0x1e
27adc at C:/usr/site/lib/Tk/Widget.pm line 98 during global destruction.
Free to wrong pool 1e26d00 not 232770 at C:/usr/site/lib/Tk/Widget.pm line 98 du
ring global destruction.
Does Tk try to share widgets between threads automatically, or am I doing something wrong?