At Thu, 12 Apr 2007 09:52:56 -0700,
Eric Wilhelm <[EMAIL PROTECTED]> wrote:
> 
> # from Jason Forkey
> # on Wednesday 11 April 2007 09:17 am:
> 
> >My build machine is a linux amd64 box.  I would like to package a perl
> > script with par to run on a target machine that is running 32 bit
> > linux.  I'm not trying to create a binary, just a perl script with
> > the necessary CPAN modules built into it.
> 
> This will only work if you build a 32-bit perl and use it to do the 
> packaging *unless* you have only pure-perl (no compiled modules) 
> bundled into it.
> 
> There does seem to be a bug in pp's -P handling (it also appears to 
> ignore -X and -n).  But in any non-trivial program, you're going to 
> need to build 32-bit versions.  If you're counting on the client having 
> perl and all of the requisite compiled modules, why bundle?
> 

My goal is to deploy my perl script with the required CPAN modules embedded in
the script.  For the moment all that I really need to include is Carp::Assert
and Log::Log4perl.  I believe both of these are pure perl modules.  The client
has a fairly recent version of perl, but does not have any CPAN modules
installed.  I have no ability to install CPAN modules at the client's site.  It
seems like a perfect problem for PAR to solve.  From the pp man page, under the
notes section:

Perl with core module installed:
  % pp -P -o packed.pl source.pl      # makes packed.exe
  # Now, deploy 'packed.pl' to target machine...
  $ perl packed.pl                    # run it

Perl with PAR.pm and its dependencies installed:
  % pp -p source.pl                   # makes source.par
  % echo "use PAR 'source.par';" > packed.pl;
  % cat source.pl >> packed.pl;       # makes packed.pl
  # Now, deploy 'source.par' and 'packed.pl' to target machine...
  $ perl packed.pl                    # run it

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.

I think there is great value in being able to deploy perl scripts that use pure
perl CPAN modules on any target machine.  Maybe this is not the most common
usage of PAR, but I would be interested in using it to deploy scripts to
solaris, linux, and maybe even windows boxes.  After all, what value is there in
using/developing pure perl modules unless you can deploy them in an architecture
independent manner.  In my case, at least, I can usually count on perl being
installed on the client machine, but rarely do I have access to the
installation.  It seams like PAR is the perfect answer to my problem.  If the
only thing that is preventing this functionality is the need to include
Compress::Zlib then perhaps an option to leave the generated script uncompressed
could be added (and turned on by default for -P :) ).

Thanks for your help.  

Reply via email to