I have a problem regarding Perl/Tk and Threads,
I made a GUI with TK and from this GUI I am calling a module which has a long runtime. Now I would like to display some status messages about this module, how far it reached.
I tried to make this with Threads, but this won't function.
sub run { #this is called via a button from the GUI
#Call the Module
$threadRun = Thread -> new (\&printExcel::Edit, $option,$path);
#print the status
&printStatus();
}
sub printStatus {
print "\n\n\n\n\n\nprint status\n";
#hier hol ich mir den neuen status
my @NewStatus = &printExcel::GetStatus();
print "new status: @NewStatus\n";
#now wait 5 seconds an call yourself
$Basic_wd -> after (5000, &printStatus(@NewStatus));
}
I know the "printStatus" sub is an endless loop, but this is not the problem. The problem is, when i call the thread, the sub defined in the thread is called, the "printStatus" sub is also called, but only once.
The sub "&printExcel::Edit" runns and when it finished, the whole Gui freezes and the progam is hooked.
Has anyone some suggetstions what i made wrong or how I could solve this problem?