pp - Perl Packager


    % pp hello                  # Pack 'hello' into executable 'a.out'
    % pp -o hello      # Pack '' into executable 'hello'
    % pp -o foo   # Pack '' and '' into 'foo'
    % ./foo                     # Run '' inside 'foo'
    % mv foo bar; ./bar         # Run '' 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 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
    % pp --output output.exe
    % pp --output=output.exe

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/

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 or -l /usr/local/lib/ 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.


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


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

Stand-alone setup
    % pp -o packed.exe        # makes packed.exe
    # Now, deploy 'packed.exe' to target machine...
    $ packed.exe                        # run it
Perl interpreter only, without core modules:
    % pp -B -p                # makes source.par
    % -B source.par  # makes
    # Now, deploy '' to target machine...
    $ perl                    # run it
Perl with core module installed:
    % pp -p                   # makes source.par
    % -b source.par  # makes
    # Now, deploy '' to target machine...
    $ perl                    # run it
Perl with and its dependencies installed:
    % pp -p                   # makes source.par
    % echo "use PAR 'source.par';" >;
    % cat >>;       # makes
    # Now, deploy 'source.par' and '' to target machine...
    $ perl                    # 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 to function correctly. Patches to include a copy of libperl with the executable are most welcome.


PAR, Module::ScanDeps,, 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 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.


Autrijus Tang <>

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

Please send bug reports to <>.


Copyright 2002, 2003 by Autrijus Tang <>.

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.