in reply to perl, Tk GUI, problem with getOpenFile, in a packed program

I don't know if this will help or not, BUT I find that when making an .exe with ActiveState some work is required. When I run from the command line, I can have a XXX.pl that just has "use Tk;". When something shows up that the autoloader needs, it gets loaded. To get that same program to compile to an standalone .exe I need lots of "use" statements to force modules into the "compiled version":
use Tk; use Tk::LabFrame; use Tk::Listbox; use Tk::Scrollbar; use Tk::Button; use Tk::Menubutton; use Tk::Menu; use Tk::Widget; use Tk::Label; use Tk::Entry;
It could very well be that you don't have enough "use" statements. These statements force compilation and inclusion of the code into the .exe file. The above are very standard widgets. Stick those "use statements" into your source. And see what happens. In std environment, "use Tk;" is enough, but that is not enough for a "compiled version".

Replies are listed 'Best First'.
Re^2: perl, Tk GUI, problem with getOpenFile, in a packed program
by gbertrand (Initiate) on Jul 22, 2009 at 16:07 UTC
    Dear Marshall,

    Following your advice, I have added all the listed inclusions. Unfortunately, they did not solve my problem in the .bin.

    Thanks,

    Gilles
      Well sorry to hear that. This can get to be a mess! The first time I did this, it took me a week to get a fully functional .exe file. You are getting run-time errors and I would try to find the fewest number of mouse clicks that creates the error reliably. Then from there, put print statements in the code and just slug through it to find what isn't getting loaded - something is missing from the .exe version that the "normal" version can run via the autoloader. You will have to figure out what that "something" is and force it into the .exe file. I'm sorry that the "simple" ideas didn't work.
Re^2: perl, Tk GUI, problem with getOpenFile, in a packed program
by Anonymous Monk on Jul 22, 2009 at 22:44 UTC
    That isn't normally required with PAR/pp
      The problem is solved!

      I have added several "use" statements explicitly to be sure that they would be packed within the binary. I have also changed the pp options that I used, which were probably wrong. I am not quite sure of the origin of my problem, but anyway, it's solved.

      Many thanks for your help.

        Great! Glad that you got things working!

        My client apps are sent out as .exe files with ActiveState tools. Server side is source code. There is a huge skill difference between the sys admin with /root access on Unix and some average Windows user! The .exe file for the Windows users is a very good way to go!

        Some folks don't believe that sometimes extra "use" statements are necessary when making these .exe files, but I have found that to be the case. I guess this is a "your mileage may vary situation". I will add that say "use Tk::Button;" is not going to "hurt" if you are actually using a Button...it won't slow the compile down or cause multiple copies of Tk::Button to be loaded or even compiled (Perl keeps track and only "uses" a module once).

        anyway congrats on your sucess...sometimes some experimentation and some "fiddling" is required!