Reusable packaged applications with PAR::Packer

tsee on 2009-07-19T17:02:10

PAR::Packer is a tool that can (among other things) create stand-alone binary executables from Perl scripts. It scans the code for dependencies and includes them in the executable.

Until now, it wasn't possible to reuse these perl-installation-in-one-file packages to run Perl code that wasn't part of the package. This proved to be a bit of a problem in some cases because many Perl applications expect to be able to simply use $^X or a verbatim "perl" executable to execute another instance of the same perl. For this reason, I just implemented the --reusable option to pp, the PAR Packager command line tool. Since this feature may have dubious security implications, it is disabled by default. To use it, you do this:

  pp --reusable -o myapp myapp.pl
  # works normally:
  ./myapp

  # runs otherapp.pl providing the module library that's part of the executable:
  ./myapp --par-options --reuse someOtherApp.pl

If you try to use the --par-options --reuse option with an application that wasn't packaged to be --reusable, it will refuse to run.

The new feature requires a new PAR and PAR::Packer release. PAR 0.993 has been uploaded to CPAN. For PAR::Packer, you need the development version 0.992_01. If either one of those isn't available from your favourite mirror yet, you can find them here temporarily.

Cheers,
Steffen