Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Trouble executing a perl script after a MainLoop using TK

45 views
Skip to first unread message

dragol...@gmail.com

unread,
Jun 10, 2016, 2:29:52 PM6/10/16
to
OK. So I've got my script working like I want using the TK to build my list of selections. Now, however, when I close the menu, it does not execute my last statement in my program to run the next script after MainLoop; Trying to run my $var =`crossref.pl`; in order to go to my next script. Before adding the menu, this worked. Now it does not. I'm posting the last 11 lines so you can see what I'm trying to do. Any help is appreciated.

my $button_frame = $mw->Frame()->pack(-side => "bottom");
my $ok_button = $button_frame->Button(-text => 'OK',
-command => \&check_sub)->pack(-side => "left");
my $exit_button = $button_frame->Button(-text => 'Exit',
-command => sub{exit})->pack(-side => "right");

sub check_sub {
my $check_msg = "Check #1: $check1\nCheck #2: $check2\nCheck #3: $check3\nCheck #4: $check4\nCheck #5: $check5\nCheck #6: $check6\nCheck #7: $check7\nCheck #8: $check8\nCheck #9: $check9\nCheck #10: $check10\nCheck #11: $check11\nCheck #12: $check12\nCheck #13: $check13\nCheck #14: $check14\n,Check #15: $check15\nCheck #16 $check16";
$mw->messageBox(-message => "Check Button Summary:\n$check_msg", -type => "ok");
}

MainLoop;

my $var =`crossref.pl`; #Should run my crossref.pl but does not.

$Bill

unread,
Jun 11, 2016, 9:25:06 AM6/11/16
to
What menu? If you press OK, you display a popup. If you press Exit, you exit the program.
MainLoop has no exit - it loops forever.

The only way to get to the stmt after MainLoop would be to call it from one of your
buttons (make it into a sub or some such) or put it in an exit handler or END {} block
if your going to it.

EG:
my $exit_button = $button_frame->Button(-text => 'Exit',
-command => sub{ my_exit (); })->pack(-side => "right");
sub my_exit { my $var =`crossref.pl`; }
or
END { my $var =`crossref.pl`; }

PS: Make sure when giving a sample script that it's runnable so it can be tested.

ulix

unread,
Sep 11, 2016, 9:53:29 AM9/11/16
to
see also www.perlmonks.org/?node_id=547320

Use $mw->destroy() instead of exit().


----Android NewsGroup Reader----
http://usenet.sinaapp.com/

--- news://freenews.netfront.net/ - complaints: ne...@netfront.net ---
0 new messages