PAR - Perl Archive Toolkit


       This document describes version 0.93 of PAR, released Mai 11, 2006.


       (If you want to make an executable that contains all module, scripts
       and data files, please consult the bundled pp utility instead.)

       Following examples assume a foo.par file in Zip format; support for
       compressed tar (*.tgz/*.tbz2) format is under consideration.

       To use from ./foo.par:

           % perl -MPAR=./foo.par -MHello
           % perl -MPAR=./foo -MHello          # the .par part is optional

       Same thing, but search foo.par in the @INC;

           % perl -MPAR -Ifoo.par -MHello
           % perl -MPAR -Ifoo -MHello          # ditto

       Following paths inside the PAR file are searched:

           /i386-freebsd/              # i.e. $Config{archname}
           /5.8.0/                     # i.e. $Config{version}
           /5.8.0/i386-freebsd/        # both of the above

       PAR files may also (recursively) contain other PAR files.  All files
       under following paths will be considered as PAR files and searched as

           /par/i386-freebsd/          # i.e. $Config{archname}
           /par/5.8.0/                 # i.e. $Config{version}
           /par/5.8.0/i386-freebsd/    # both of the above

       Run script/ or from foo.par:

           % perl -MPAR foo.par        # only when $0 ends in '.par'

       However, if the .par archive contains either script/ or,
       then it is used instead:

           % perl -MPAR foo.par        # runs; @ARGV is ''

       Use in a program:

           use PAR 'foo.par';
           use Hello; # reads within foo.par

           # PAR::read_file() returns a file inside any loaded PARs
           my $conf = PAR::read_file('data/MyConfig.yaml');

           # PAR::par_handle() returns an Archive::Zip handle
           my $zip = PAR::par_handle('foo.par')
           my $src = $zip->memberNamed('lib/')->contents;

       You can also use wildcard characters:

           use PAR '/home/foo/*.par';  # loads all PAR files in that directory


       This module lets you easily bundle a typical blib/ tree into a zip
       file, called a Perl Archive, or "PAR".

       It supports loading XS modules by overriding DynaLoader bootstrapping
       methods; it writes shared object file to a temporary file at the time
       it is needed.

       To generate a .par file, all you have to do is compress the modules
       under arch/ and lib/, e.g.:

           % perl Makefile.PL
           % make
           % cd blib
           % zip -r mymodule.par arch/ lib/

       Afterward, you can just use mymodule.par anywhere in your @INC, use
       PAR, and it will Just Work.

       For convenience, you can set the "PERL5OPT" environment variable to
       "-MPAR" to enable "PAR" processing globally (the overhead is small if
       not used); setting it to "-MPAR=/path/to/mylib.par" will load a spe-
       cific PAR file.  Alternatively, consider using the utility bun-
       dled with this module, or using the self-contained parl utility on
       machines without installed.

       Note that self-containing scripts and executables created with
       and pp may also be used as .par archives:

           % pp -o packed.exe        # generate packed.exe
           % perl -MPAR=packed.exe    # this also works
           % perl -MPAR -Ipacked.exe  # ditto

       Please see "SYNOPSIS" for most typical use cases.


       Settings in META.yml packed inside the PAR file may affect PAR's opera-
       tion.  For example, pp provides the "-C" ("--clean") option to control
       the default behavior of temporary file creation.

       Currently, pp-generated PAR files may attach four PAR-specific
       attributes in META.yml:

             clean: 0          # default value of PAR_CLEAN
             signature: ''     # key ID of the SIGNATURE file
             verbatim: 0       # was packed prerequisite's PODs preserved?
             version: x.xx     # version that generated this PAR

       User-defined environment variables, like PAR_CLEAN, always overrides
       the ones set in META.yml.  The algorithm for generating caching/tempo-
       rary directory is as follows:

       o   If PAR_GLOBAL_TEMP is specified, use it as the cache directory for
           extracted libraries, and do not clean it up after execution.

       o   If PAR_GLOBAL_TEMP is not set, but PAR_CLEAN is specified, set
           PAR_GLOBAL_TEMP to "TEMP/par-USER/temp-PID/", cleaning it after

       o   If both are not set,  use "TEMP/par-USER/cache-HASH/" as the
           PAR_GLOBAL_TEMP, reusing any existing files inside.

       Here is a description of the variables the previous paths.

       o   TEMP is a temporary directory, which can be set via
           that order of priority.  If none of those are set, C:\TEMP, /tmp
           are checked.  If neither of them exists, . is used.

       o   USER is the user name, or SYSTEM if none can be found.  On Win32,
           this is $Win32::LoginName.  On Unix, this is "$ENV{USERNAME"> or

       o   PID is the process ID.  Forked children use the parent's PID.

       o   HASH is a crypto-hash of the entire par file or executable, calcu-
           lated at creation time.  This value can be overloaded with "pp"'s
           --tempdir parameter.

       By default, PAR strips POD sections from bundled modules. In case that
       causes trouble, you can turn this off by setting the environment vari-
       able "PAR_VERBATIM" to 1.


       PAR::Tutorial, PAR::FAQ, parl, pp

       Archive::Zip, "require" in perlfunc

       ex::lib::zip, Acme::use::strict::with::pride


       Nicholas Clark for pointing out the mad source filter hook within the
       (also mad) coderef @INC hook, as well as (even madder) tricks one can
       play with PerlIO to avoid source filtering.

       Ton Hospel for convincing me to ditch the "Filter::Simple" implementa-

       Uri Guttman for suggesting "read_file" and "par_handle" interfaces.

       Antti Lankila for making me implement the self-contained executable
       options via " -O".

       See the AUTHORS file in the distribution for a list of people who have
       sent helpful patches, ideas or comments.


       Audrey Tang <>

       <> is the official PAR website.  You can write to
       the mailing list at <>, or send an empty mail to <par-sub-> to participate in the discussion.

       Please submit bug reports to <>. If you need sup-
       port, however, joining the <> mailing list is preferred.


       Copyright 2002, 2003, 2004, 2005, 2006 by Audrey Tang

       This program is free software; you can redistribute it and/or modify it
       under the same terms as Perl itself.

       See <>

perl v5.8.8                       2006-05-30                            PAR(3)
See also App::Packer::PAR(3)
See also PAR::Dist(3)
See also PAR::FAQ(3)
See also PAR::Filter(3)
See also PAR::Filter::Bleach(3)
See also PAR::Filter::Bytecode(3)
See also PAR::Filter::Obfuscate(3)
See also PAR::Filter::PatchContent(3)
See also PAR::Filter::PodStrip(3)
See also PAR::Heavy(3)
See also PAR::Packer(3)
See also PAR::Tutorial(3)

Man(1) output converted with man2html