NAME

pp - Perl Packager

SYNOPSIS

    % 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)

DESCRIPTION

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

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
-M, --add=MODULE|FILE

Adds the specified module into the package, along with its dependencies. Also accepts filenames relative to the @INC path; i.e. -M Module::ScanDeps means the same thing as -M Module/ScanDeps.pm.

If FILE does not have a .pm/.ix/.al extension, it will not be scanned for dependencies, and will be placed under / instead of /lib/ inside the PAR file.

-B, --bundle
Bundles core modules in the resulting package. This option is enabled by default, except when -p is specified and -o is unspecified.
-e, --eval=STRING
Package a one-liner, much the same as perl -e '...'
-X, --exclude=MODULE
Excludes the given module from the dependency search patch and from the package.
-g, --gui
Build an executable that does not have a console window. This option is ignored on non-MSWin32 platforms or when -p is specified.
-h, --help
Shows basic usage information.
-I, --lib=DIR
Adds the given directory to the perl library file search path.
-l, --link=FILE|LIBRARY
Adds the given shared library (a.k.a. shared object or DLL) into the packed file. Also accepts names under library paths; i.e. -l ncurses means the same thing as -l libncurses.so or -l /usr/local/lib/libncurses.so in most Unixes.
-L, --log=FILE
Log the output of packaging to a file rather than to stdout.
-m, --multiarch
Generate architecture-specific layout;
-o, --output=FILE
Specifies the file name for the final packaged executable.
-p, --par
Create PAR archives only; do not package to a standalone binary.
-r, --run
Run the resulting packaged script after packaging it.
-S, --save
Do not delete generated PAR file after packaging.
-v, --verbose[=NUMBER]
Increase verbosity of output; NUMBER is an integer from 0 to 5, 5 being the most verbose. Defaults to 1 if specified without an argument.
-V, --version
Display the version number and copyrights of this program.

ENVIRONMENT

PP_OPTS
Command-line options (switches). Switches in this variable are taken as if they were on every pp command line.

NOTES

Here are some recipes showing how to utilize pp to bundle source.pl with all its dependencies, on target machines with different expected settings:

Stand-alone setup
    % pp -o packed.exe source.pl        # makes packed.exe
    # Now, deploy 'packed.exe' to target machine...
    $ packed.exe                        # run it
Perl interpreter only, without core modules:
    % 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
Perl with core module installed:
    % 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
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

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.

SEE ALSO

PAR, Module::ScanDeps, par.pl, parl, perlcc

ACKNOWLEDGMENTS

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 -g flag.

Mattia Barbon for providing the myldr binary loader code.

Jeff Goff for suggesting the name pp.

AUTHORS

Autrijus Tang <autrijus@autrijus.org>

PAR has a mailing list, <par@perl.org>, that you can write to; send an empty mail to <par-subscribe@perl.org> to join the list and participate in the discussion.

Please send bug reports to <bug-par@rt.cpan.org>.

COPYRIGHT

Copyright 2002, 2003 by Autrijus Tang <autrijus@autrijus.org>.

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.

See http://www.perl.com/perl/misc/Artistic.html