# from Jason Forkey
# on Thursday 12 April 2007 12:14 pm:

>It appears from this that the purpose of the -P switch is to generate
> a perl script that can be run at a site that has a basic perl
> installation.  If the client has PAR installed then the -p option can
> be used, but -P is supposed to generate a standalone perl script.

Possibly.  I think you're running into some assumptions and defaults 
though.  I'm thinking you'll either need a completely different flag or 
some changes to the interactions of the options.  I'm not sure how many 
people are using -P.  I'm also not sure that par will do what you want.

$ unzip -l hello.pl
Archive:  hello.pl
  Length     Date   Time    Name
 --------    ----   ----    ----
        0  04-12-07 12:35   script/
      437  04-12-07 12:35   MANIFEST
      215  04-12-07 12:35   META.yml
       23  04-12-07 12:35   script/hello_in.pl
      280  04-12-07 12:35   script/main.pl
 --------                   -------
      955                   5 files

$ strace -o /tmp/stracefile ./hello.pl

$ grep '/tmp/par-ewilhelm/' /tmp/stracefile
<lots of noise here>

That indicates that par is unpacking the .pl as a zip into a temp dir.  
This is probably the most reliable way to do it (since a lot of modules 
expect to be in a file of their own), but the default is to bundle some 
compiled code to make that happen.

If you can count on the target machine having tar and gzip, you might 
have a easier time just shipping a tarball and adding a 
dirname($0)."/libs" to @INC or something.  Similarly, you could rely on 
`unzip` being present on the client machine, then package a .par and 
use 'cat' to make a packed.pl from yourprog.pl and foo.par.

Alternatively, you require that the client has Archive::Zip installed 
and figure out how to make the .pl not embed/use your 64-bit one.  That 
doesn't look at all easy.

Note that one could in some cases (where the .pm's don't expect to live 
next to something, etc.) simply concatenate the pure-perl modules into 
BEGIN blocks and set $INC{"Mod/Name.pm"} = __FILE__; at the end of each 
one.

I don't think that simplistic concatenation is really par's thing (as it 
would greatly complicate PAR but be roughly 100 lines in its own 
module/program), though Module::ScanDeps might be useful in determining 
which modules to chunk together.  Anyway, might work in about 80% of 
cases.  For the rest, you either use CPAN or get creative.

--Eric
-- 
software:  a hypothetical exercise which happens to compile.
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------

Reply via email to