in reply to tkpp fails if images used

First, I would change the "shebang" line to #!/usr/bin/perl. If you use #!/usr/bin/perl -w, windows will not pay attention to the perl path, but it will understand the -w (use warnings) option.

The above is a tip for the future. That is not the problem now.

I have been down some "merry paths through hell" with .exe files.

Your error messages are probably just the "tip of the iceberg". Sorry about that, but I'll explain how to deal with it...

Whats happening is that the .exe is trying to run something that isn't in the .exe. "use" is different than "require" and the autoloader isn't available for a .exe file.

What all of these boils down to is: to make a successful .exe file, you need to explicitly "use" many Tk::module things that you wouldn't normally have to, like: use Tk::Image.

It is highly likely that you will miss one or more use Tk::X statements, like maybe one below. Your .pl program should explicitly "use" all OO modules that will be later used at run-time. The process is actually straightforward: make .exe, run program, test to find the OO module that "didn't make it into .exe", "use" that module, then go again. You are tripping over "run-time" landmines.

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;

Replies are listed 'Best First'.
Re^2: tkpp fails if images used
by Anonymous Monk on Sep 03, 2009 at 02:48 UTC
    First, I would change the "shebang" line to #!/usr/bin/perl. If you use #!/usr/bin/perl -w, windows will not pay attention to the perl path, but it will understand the -w (use warnings) option. The above is a tip for the future. That is not the problem now.

    It is not a problem at all since memo already has use warnings;

Re^2: tkpp fails if images used
by memo.garciasir (Acolyte) on Sep 07, 2009 at 19:21 UTC

    Thanks

    What do you mean with 'test to find the OO module that "didn't make it into .exe"'?

    How can I find the missin module(s)?

    memo

      This is ugly, I don't know of any short cuts. "testing" means run your program exercising all Tk windows and widgets then see where program generates run time warning. The Perl can find lots of stuff by just "use Tk" in a script form that it can't find in the .exe form.

      Anyway from my experience with this, it is an iterative process. But it doesn't take long as error message will give you a clue as to what is missing.

      Now when I'm writing the code for something that will be in a .exe file, I just add a "use" statement for every different Tk widget that is used in the code. I usually miss one and have to go back and add it.