http://qs1969.pair.com?node_id=1136791

dbarstis has asked for the wisdom of the Perl Monks concerning the following question:

Kind monks of the monastery, I have what should be a simple issue to resolve but am having trouble finding a solution. I have a simple script using Tk with a menubar. The script runs fine when invoked with the perl command but the menubar is no where to be seen when an executable is built with pp. This is on a Windows machine with Strawberry Perl 5.14.2 and Tk 804.033 (actually the DWIM install). Any and all wisdom would be greatly appreciated.

use Tk; my $mw = MainWindow->new; my $menubar = $mw->Menu(); $mw->configure( -menu => $menubar ); my $file = $menubar->cascade( -label => '~File' ); $file->command( -label => '~Quit', -command => sub { exit }, -accelerator => 'Ctrl-Q' ); $mw->bind( '<Control-q>', sub { exit } ); $mw->MainLoop(); exit;

Replies are listed 'Best First'.
Re: Perl/Tk, PAR::Packer and Menus
by Anonymous Monk on Jul 29, 2015 at 23:20 UTC

    but the menubar is no where to be seen when an executable is built with pp

    So you just went "pp myfoo.pl" right?

    That is not going to work, you need pp -x

      Thank you kind Anonymous Monk. The -x flag did the trick. I was just using pp -o myfoo.exe myfoo.pl. This is my first Perl/Tk application and have learned that I must RTFM a little bit more. Your help is greatly appreciated.

Re: Perl/Tk, PAR::Packer and Menus
by fishmonger (Chaplain) on Jul 29, 2015 at 21:23 UTC

    Are you receiving any errors/warnings?

    I have not run any tests and haven't used Tk for awhile, but try adding use Tk::Menu;

      It seems like a path issue. The perl interpreter can find the Tk modules but pp cannot. What would I link (a dll?) if that is the case? I'm a Linux guy trying to slog my way through a Windows app.

        In addition to putting the use statement in the script, use the -M option in the pp command.

        pp -M Tk::Menu ....

      There are no error messages. Adding use Tk::Menu; had no effect.

Re: Perl/Tk, PAR::Packer and Menus
by fishmonger (Chaplain) on Jul 29, 2015 at 22:05 UTC

    I just ran a test using your script without the adjustments I suggested and couldn't reproduce your problem.