I am executing a perl script as a part of other bigger code. My perl code opens up a pop up window based on status value (success or failure). This issue is, the script does not continue executing other parts of code untill I close this pop up window created by perl. How can I solve this. Please help. I want to keep the pop up open and continue executing other parts of parent script. I am using following perl script to open up pop up.
#!/usr/local/bin/perl
use Tk;
my $status = shift;
my $opt = shift;
my $mw = MainWindow->new;
$mw->title("DONE");
if($status eq "success") {
$mw->Label(-text => "$opt dummyFill for 'test1' succeeded", -background => "green")->pack(-ipadx => 10, -ipady => 10);
$mw->Button(-text => "Close", -background => "green", -command => sub { exit})->pack(-fill => "x");
} else {
$mw->Label(-text => "$opt dummyFill for 'test1' FAILED", -background => "red")->pack(-ipadx => 10, -ipady => 10);
$mw->Button(-text => "Close", -background => "red", -command => sub { exit})->pack(-fill => "x");
}
$mw->geometry("+250+50");
MainLoop;
I appreciate your help.
Thanks Sam
Your main script is probably waiting for a return from the call to Perl. In Tk Perl stays in the MainLoop either you call the TK specific exit routine, which closes out the main window, or directly call destroy on your main window object.
The solution isn't in this script but in the calling code. The calling code needs to fork the execution of this Perl script into a separate process or thread.