• Trouble executing a perl script after a MainLoop using TK

    From dragolarik76@gmail.com@21:1/5 to All on Fri Jun 10 11:29:51 2016
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From $Bill@21:1/5 to dragolarik76@gmail.com on Sat Jun 11 06:24:56 2016
    On 6/10/2016 11:29, dragolarik76@gmail.com wrote:
    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.

    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From ulix@21:1/5 to All on Sun Sep 11 15:53:26 2016
    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: news@netfront.net ---

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)