Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

PP: Executables still need require files.....

by gepebril69 (Scribe)
on Jul 20, 2012 at 13:31 UTC ( #982825=perlquestion: print w/replies, xml ) Need Help??
gepebril69 has asked for the wisdom of the Perl Monks concerning the following question:

Hi there,

I'm working with Perl a few years now and thanks to pp I manage to get executables instead of scripts. However I use 2 pl files to store defines and basic functions like this:

require File::HomeDir->my_home."\\software\\scripts\\"; require File::HomeDir->my_home."\\software\\scripts\\";

If I remove these files after I created executables I still need these files at runtime :S

call pp -o fill_usb_stick.exe -x -c -vvv <code>

What am I doing wrong, or do I need to take a different approach?

Yours sincerely.

Replies are listed 'Best First'.
Re: PP: Executables still need require files.....
by marto (Archbishop) on Jul 20, 2012 at 14:32 UTC

    I can't think of a sensible way to get this to work with the File::HomeDir module. Perhaps it would be better if you took a slightly different approach and had your required files in a sub directory of your main script, for example:

    #!/usr/bin/perl use strict; use warnings; require "tmpinc\\"; require "tmpinc\\";


    #!/usr/bin/perl print "in\n";


    #!/usr/bin/perl print "in\n";

    packaging with a command similar to you:

    c:\pp -o pptest.exe -x -c

    and running the resulting executable shows:

    C:\>pptest.exe in in

      I will give it a try, was using this File::HomeDir as I was developing on two different servers.

        It worked!!!!

        Thanks very much!

Re: PP: Executables still need require files.....
by CountZero (Bishop) on Jul 20, 2012 at 14:51 UTC
    You can always use the -a or --addfile argument to force pp to include files it might otherwise miss.

    However, there is no guarantee that the home directory on your system is the same on other systems. I do not think pp is bright enough to find out where it has to drop these files. Much better to keep them in the same directory as your main script.


    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

    My blog: Imperial Deltronics
Re: PP: Executables still need require files.....
by zentara (Archbishop) on Jul 20, 2012 at 13:37 UTC
    do I need to take a different approach?

    How about just installing Perl on the target machines, and give them a script? :-) TGIF

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
Re: PP: Executables still need require files.....
by dasgar (Priest) on Jul 20, 2012 at 13:53 UTC

    Here's what I would try. Put all 3 .pl files in the same directory. Modify your require calls to be:

    require; require;

    With your same call to pp to build the .exe file, I think that this should pick up the two other .pl files, but I have not tested this myself.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://982825]
Approved by marto
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2018-05-25 05:55 GMT
Find Nodes?
    Voting Booth?