NAME
PAR - Perl Archive
VERSION
This document describes version 0.03 of PAR.
SYNOPSIS
Following examples assume a foo.par file in Zip format; support for compressed gzip (*.tgz) format is planned.
To use Hello.pm, lib/Hello.pm or lib/arch/Hello.pm 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
Run test.pl or script/test.pl from foo.par:
% perl -MPAR foo.par test.pl # only when $0 ends in '.par'
Used 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/Hello.pm')->contents;
DESCRIPTION
This module let you easily bundle a blib/ tree into a zip file, called a Perl Archive, or PAR
.
To generate a .par file, all you have to do is compress a lib/ tree containing modules, e.g.:
% perl Makefile.PL
% make
% cd blib
% zip -r mymodule.par lib/
Afterwards, you can just use mymodule.par anywhere in your @INC
, use PAR, and it would Just Work.
For maximal convenience, you can set the PERL5OPT
environment variable to -MPAR
to enable PAR
processing globally (the overhead is small if not used), or to -MPAR=/path/to/mylib.par
to load a specific PAR file.
Please see "SYNOPSIS" for most typical use cases.
SEE ALSO
Archive::Zip, "require" in perlfunc
ex::lib::zip, Acme::use::strict::with::pride
ACKNOWLEDGMENTS
Nicholas Clark for pointing out the mad source filter hook within the (also mad) coderef @INC
hook.
Ton Hospel for convincing me to ditch the Filter::Simple
implementation.
AUTHORS
Autrijus Tang <autrijus@autrijus.org>
COPYRIGHT
Copyright 2001 by Autrijus Tang <autrijus@autrijus.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.