pp - Perl Packager
% pp hello # Pack 'hello' into executable 'a.out' % pp -o hello hello.pl # Pack 'hello.pl' into executable 'hello'
% pp -o foo foo.pl bar.pl # Pack 'foo.pl' and 'bar.pl' into 'foo' % ./foo # Run 'foo.pl' inside 'foo' % mv foo bar; ./bar # Run 'bar.pl' inside 'foo' % mv bar baz; ./baz # Error: Can't open perl script "baz"
% pp -p file # Creates a PAR file, 'file.par' % pp -S -o hello file # Creates a PAR file, 'file.par', # then packages it to executable 'hello' % pp -p -o out.par file # Creates 'out.par' from 'file' % pp -B -p -o out.par file # same as above, but bundles core modules # (-B is assumed when making executables)
% pp -e 'print q//' # Pack a one-liner into 'a.out' % pp -p -e 'print q//' # Creates a PAR file 'a.out.par'
% pp -I /foo hello # Extra paths (notice space after -I) % pp -M Foo::Bar hello # Extra modules (notice space after -M) % pp -M abbrev.pl hello # Extra files under @INC % pp -X Foo::Bar hello # Exclude modules (notice space after -X)
% pp -r hello # Pack 'hello' into 'a.out', runs 'a.out' % pp -r hello a b c # Pack 'hello' into 'a.out', runs 'a.out' # with arguments 'a b c'
% pp hello --log=c # Pack 'hello' into 'a.out', logs # messages into 'c' % pp --gui -o out.exe hello # Pack 'hello' into a console-less # 'out.exe' (Win32 only)
pp creates standalone executables from Perl programs, using the compressed packager provided by PAR, and dependency detection heuristics offered by Module::ScanDeps. Source files are compressed verbatim without compilation.
You may think of pp as "perlcc that works without hassle". :-)
It does not provide the compilation-step acceleration provided by perlcc (although a ByteLoader variant of pp is entirely possible), but makes up for it with better reliability, smaller executable size, and full retrieval of original source code.
If a single input program is specified, the resulting executable will
behave identically as that program. However, when multiple programs
are packaged, the produced executable will run the one that has the
same basename as
$0 (i.e. the filename used to invoke it). If
nothing matches, it dies with the error
Can't open perl script "$0".
On Microsoft Windows platforms, a.exe is used instead of a.out as the default executable name.
Options are available in a short form and a long form. For example, the three lines below are all equivalent:
% pp -o output.exe input.pl % pp --output output.exe input.pl % pp --output=output.exe input.pl
Adds the specified module into the package, along with its dependencies.
Also accepts filenames relative to the
@INC path; i.e.
Module::ScanDeps means the same thing as
If FILE does not have a
.al extension, it will not
be scanned for dependencies, and will be placed under
/ instead of
/lib/ inside the PAR file.
-pis specified and
perl -e '...'
-l ncursesmeans the same thing as
-l /usr/local/lib/libncurses.soin most Unixes.
5being the most verbose. Defaults to
1if specified without an argument.
Here are some recipes showing how to utilize pp to bundle source.pl with all its dependencies, on target machines with different expected settings:
% pp -o packed.exe source.pl # makes packed.exe # Now, deploy 'packed.exe' to target machine... $ packed.exe # run it
% pp -B -p source.pl # makes source.par % par.pl -B -Opacked.pl source.par # makes packed.pl # Now, deploy 'packed.pl' to target machine... $ perl packed.pl # run it
% pp -p source.pl # makes source.par % par.pl -b -Opacked.pl source.par # makes packed.pl # Now, deploy 'packed.pl' to target machine... $ perl packed.pl # run it
% 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
Note that if your perl was built with a shared library, the 'Stand-alone setup' above will still need a separate perl5x.dll or libperl.so to function correctly. Patches to include a copy of libperl with the executable are most welcome.
PAR, Module::ScanDeps, par.pl, parl, perlcc
Simon Cozens, Tom Christiansen and Edward Peschko for writing perlcc; this program try to mimic its interface as close as possible, and copied liberally from their code.
Jan Dubois for writing the exetype.pl utility, which has been
partially adapted into the
Mattia Barbon for providing the
myldr binary loader code.
Jeff Goff for suggesting the name
Autrijus Tang <email@example.com>
PAR has a mailing list, <firstname.lastname@example.org>, that you can write to; send an empty mail to <email@example.com> to join the list and participate in the discussion.
Please send bug reports to <firstname.lastname@example.org>.
Copyright 2002, 2003 by Autrijus Tang <email@example.com>.
Neither this program nor the associated parl program impose any licensing restrictions on files generated by their execution, in accordance with the 8th article of the Artistic License:
"Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package."
Therefore, you are absolutely free to place any license on the resulting executable, as long as the packed 3rd-party libraries are also available under the Artistic License.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.