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

Hi there! I wrote a small tk applikation in which i use the $menu=$mw->Menu(...) to construct a menu like we know it from windows applications. This works fine, as does the rest of the script. i.e. i get a nice little gui (which does nothing much yet). Now i want to make a win32 executable out of it using pp. It works well BUT it does not provide me with the menubar in the exactuable. Any idea what i might make wrong or what i should do? thanks for any help! Georg PS.: im using activstate perl (and i dont get any error messages while packing the script)

Replies are listed 'Best First'.
Re: perltk menu in pp executable
by marto (Cardinal) on Mar 30, 2011 at 09:55 UTC

    Hi, perhaps a module you use isn't being detected by pp (or Module::ScanDeps). Could you post (note the formatting advice dispayed on the page) a short example script which reproduces the problem, and how you're using pp to generate the executable? Do you see any errors/warnins if you call the exe you generated via the command line?

Re: perltk menu in pp executable
by Anonymous Monk on Mar 30, 2011 at 10:07 UTC
Re: perltk menu in pp executable
by zentara (Cardinal) on Mar 30, 2011 at 22:54 UTC
      I have also heard good reports about Cava, but have never used it myself as I have an Active State Pro license (can send one of my standalone .exe's to anybody I want without extra license fees). Detecting that: $menuWhatever=$mw->Menu(...); means to include Tk::Menu is a "moving target", requires some heuristic "smarts" and requires updates as more widgets are added. Active State does this for more than one library, Tk, just being one.

      As near as I can tell ALL of these things require some amount of pain and learning curve. There just isn't a "do XYZ and it works solution" for all situations.

Re: perltk menu in pp executable
by vkon (Curate) on Mar 30, 2011 at 11:43 UTC
    For Tk, there are lot of standard widgets that autodetected, but they actually lie in their own package, i.e. Menu widget lies in Tk::Menu

    if you place this:

    use Tk; use Tk::Menu;
    then probably packaging with PAR will be better.

    I consider this is a bug, but anyway it is a way to go.

      I've come across this many times. When I write the code I now, just as a matter of habit, put a "use" statement in every time that I start using a new type of widget. This will apply to anything that is auto loaded at run time. Testing one of the pp exe files is important as occasionally it will "blow up" when some code is encountered that needs something that is not there.

      Since the Op is on Active State, I would consider buying a copy of their dev kit which will contain the PerlApp program. Active State has included some heuristics for common libraries like Tk. PerlApp scans the source code looking for extra things that need to be forced into the .exe. In the Op's case it would have automatically included Tk::Menu into the resulting .exe without him having to put a use statement in the source code.

      The disadvantage is that PerlApp will set you back a couple hundred dollars. If you are doing this code for a company, that is the best way to go as this program can do all sorts of other little zoomy touches (include an icon, put in the Microsoft version info in for the file, etc). A few hundred bucks is typically not a problem compared with the time and hassle that this will save the Op.

      It is also possible to add command line args that "force" modules into the final .exe, but in my opinion adding a "use" statement in the source code is a far superior solution.

        Thanks for all your postings! I tried the whole thing on a different machine (with obviously a slightly different perl environment) and it worked. I believe it is now up to me to check where the differences are. Thanks again for your fast replies! -ged
      then probably packaging with PAR will be better. I consider this is a bug, but anyway it is a way to go.

      That is actually not the problem given

      $ pmvers pp PAR PAR::Packer Tk pp: 1.009 PAR: 1.002 PAR::Packer: 1.009 Tk: 804.029
        My point is - "placing 'use Tk::Menu;' could solve the problem"
        I can not see how your answer answers my message.