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

Fellow PAR users,

I have an program that makes a system call to an executable a la: my @output = `figlet Hello`. The problem is that figlet, my executable, is not on the destination computers by default. So, I'd like to package it up with pp, like so: pp --output=myprog --addfile=figlet script.pl

Problem is that when I run the delivered executable on the destination computer, figlet is apparently not in the path (where does PAR stick it?) How can I specify a path to this executable? Should I be executing figlet in a different way?

Update: I found that at least on Solaris, the pp'ed executable uncompressed into /tmp/par-cache/cache-nnnn/ and the added files go into inc directory within there. However, my added executable is for some reason uncompressed with 664 permissions and is no longer executable. What gives?

Replies are listed 'Best First'.
Re: PAR --addfile
by SpanishInquisition (Pilgrim) on Sep 28, 2004 at 20:37 UTC
    You can just cat the binary data from 'figlet' into your __DATA__ segment and then write it to file when your program runs.

    No, don't do that. I'm joking. Seriously.

Re: PAR --addfile
by perlfan (Parson) on Sep 28, 2004 at 21:25 UTC
    664 is either the default mode used by PAR for external files or is controlled by your UMASK setting. You may want to change the mode of the figlet explicitly in your script right before you call it using Perl's chmod or using a system call.

    I can see how PAR may just try to ensure that it is readable, so I am not sure. PAR does have a mailing list as well, so they may be of more help.
Re: PAR --addfile
by perlfan (Parson) on Sep 28, 2004 at 19:18 UTC
    AFAIK, PAR just handles PERL scripts and their dependancy on PERL modules/files. I imagine that is doesn't part system calls in order to figure out what you are trying to do. You probably have to include any system utilities such as this "figlet" program separately.
      You are very correct. That is why I have to specify --addfile=figlet when calling pp.
Re: PAR --addfile
by iburrell (Chaplain) on Sep 28, 2004 at 19:40 UTC
    Why don't you ship the executable separately? You would distribute two files, the PAR archive and the figlet executable. This makes it easier to find since you know where it is.
Re: PAR --addfile
by fglock (Vicar) on Sep 28, 2004 at 21:23 UTC

    I can't test this right now - Try inspecting what's in %PAR::LibCache - I guess you will find the file's location there.

Re: PAR --addfile
by Beechbone (Friar) on Nov 05, 2013 at 14:39 UTC
    This comes up early on Google...

    Documentation is at http://cpansearch.perl.org/src/RSCHUPP/PAR-Packer-1.015/contrib/docs/where_is_it.txt

    BTW: The solution when running unter "clean" is not quite right. The files will be extracted, just to a different location. I found scanning @INC to be the simplest solution.

    sub extrafile($) { return $_.'/'.$_[0] if -e $_.'/'.$_[0] for @INC; die $_[0].' is missing'; }


    Search, Ask, Know