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

Hi

I'm using the following command on ActiveState 5.8.6 / WinXP:

pp tk_example.pl
I get a working windows binary.

However, my Prima example...

pp prima_example.pl
Produces a binary which won't run:
Can't locate Prima/Buttons.pm in @INC

I tried using WinZIP to establish whether the .exe contained the Buttons.pm file, but it said the file was corrupted.

How do I figure out whether the problem is related to the pp step or something to do with @INC at runtime?

Any ideas, please?

Replies are listed 'Best First'.
Re: pp/prima problem
by thundergnat (Deacon) on May 30, 2005 at 18:06 UTC

    If it says it can't find a module, that is usually pretty much what it means. Does your script run ok when you call it with the perl interpreter? Where is the Buttons module located? Are you sure it isn't supposed to be Tk::Button? (no "s")

Re: pp/prima problem
by tchatzi (Acolyte) on May 30, 2005 at 18:31 UTC
    There are two modules out there Prima::Buttons and Tk::Button
    Be sure you have installed what you need
    Just
    ppm> install Prima::Buttons ppm> install Tk::Button

    If the answer is 'the module is allready installed' then you have the modules.
    But if you say that you get 'Can't locate Prima/Buttons.pm in @INC' then probably you don't have it.
    Or you do but in the wrong location. Do a file search for it and if you do have it then use on top of your script

    push (@INC, "/location/of/module");

    But this is not the right solution. The right one is to install it in the right location, where every module is.

    ``The wise man doesn't give the right answers, he poses the right questions.'' TIMTOWTDI
      Thanks for the replies.

      The modules are all installed ok because the scripts work correctly from the command box and also when I execute them in Eclipse.

      It's a pp related problem - here's the full error message:

      C:\DOCUME~1\STEVE\MYDOCU~1\JAVA\ECLIPSE\ECLIPSE\WORKSP~1\PERLTEST>a.ex +e Can't locate Prima/Buttons.pm in @INC (@INC contains: CODE(0xcb9f60) C +ODE(0xda9a b8) .) at (eval 48) line 1. BEGIN failed--compilation aborted at (eval 48) line 1. BEGIN failed--compilation aborted at script/prima_pointer.pl line 9.
      Does "@INC contains: CODE(0xcb9..." suggest that @INC is being corrupted when the exe fires up?
        Does "@INC contains: CODE(0xcb9..." suggest that @INC is being corrupted when the exe fires up?
        No. It's a way to have smart libraries: by including a callback (a code ref) in @INC. See require:
        You can also insert hooks into the import facility, by putting directly Perl code into the @INC array. There are three forms of hooks: subroutine references, array references and blessed objects.
        (You can read the rest there.)

        What happens, is IMO that pp didn't know that Prima::Buttons is needed, so it didn't include it. Probably, that happens because the module gets required dynamically, I guess it could likely happen with DBD::* modules for DBI, too.

        See the docs for pp, command line option -M:

        % pp -M Foo::Bar hello # Extra modules in the include path
Re: pp/prima problem
by the_slycer (Chaplain) on May 30, 2005 at 19:22 UTC
    Don't know if it's related or not but..

    Back when I used to use perl2exe, I'd get similar errors with Tk:: components. The key was to explicitly use the components. If you're not explicitly useing the module, maybe try that.
      I don't know if you know this link, PP Man Pages, Take a look at it.
      When you include modules with pp like Foo::Boo, be sure you include the Foo module too, sometimes it causes problems cause the Boo module might uses Foo module, or it's functions

      ``The wise man doesn't give the right answers, he poses the right questions.'' TIMTOWTDI
        The Prima GUI standalone exe is now working ok...

        Seems like the dependency detection within PP prefers this:

        use Prima; use Prima::Buttons; use Prima::Application; use Prima::MsgBox; use Prima::StdBitMap;

        to this...

        use Prima qw(StdBitmap Buttons Application MsgBox);
        Many Thanks :) Steve