S
Shea Martin
I am trying to add an alert pop-up message box to some perl scripts.
sub MsgBox
{
my $msg = shift;
if( length($msg) <= 0 )
{
$msg = "empty message?";
}
my $mw = Tk::MainWindow->new();
$mw->Label(-text => $msg)->pack;
$mw->Button(-text => 'ok', -command => sub{exit})->pack;
&Tk::MainLoop();
}
The problem is, I want to return to my perl script after the the 'ok'
button has been pressed. Obviously sub{exit} is the problem, but I
don't know what else to put? It won't let me put return or last in
there. I am sure that there is a simple way to do this, but I can't see
the forest for the trees.
~S
sub MsgBox
{
my $msg = shift;
if( length($msg) <= 0 )
{
$msg = "empty message?";
}
my $mw = Tk::MainWindow->new();
$mw->Label(-text => $msg)->pack;
$mw->Button(-text => 'ok', -command => sub{exit})->pack;
&Tk::MainLoop();
}
The problem is, I want to return to my perl script after the the 'ok'
button has been pressed. Obviously sub{exit} is the problem, but I
don't know what else to put? It won't let me put return or last in
there. I am sure that there is a simple way to do this, but I can't see
the forest for the trees.
~S