Apache-PAR
view release on metacpan or search on metacpan
Alias /myapp/mod/ ##PARFILE##/
<Location /myapp/mod>
SetHandler perl-script
PerlSetEnv TestModTemplateDir ##UNPACKDIR##/template
PerlHandler TestMod
</Location>
Using PerlInitHandler to reload changed modules:
PerlModule Apache::PAR
PerlInitHandler Apache::PAR
=head1 DESCRIPTION
Apache::PAR is a framework for including Perl ARchive files in a mod_perl (1.x or 2.x)
environment. It allows an author to package up a web application, including configuration,
static files, Perl modules, and Registry and PerlRun scripts to include in a single file.
This archive can then be moved to other locations on the same system or distributed, and
loaded with a single set of configuration options in the Apache configuration.
These modules are based on PAR.pm by Autrijus Tang and Archive::Zip by Ned Konz, as well as
the mod_perl modules. They extend the concept of PAR files to mod_perl, similar to how WAR
archives work for Java. An archive (which is really a zip file), contains one or more
elements which can be served to clients making requests to an Apache web server.
Scripts, modules, and static content should then be able to be served from within the .par
archive without modifications.
Apache::PAR itself performs the work of specifying the location of PAR archives and allowing
the loading of modules from these archives. The files and paths can be specified at load time. Once an archive has been located, an optional web.conf (filename configurable) is then loaded and included into the main web configuration. Once Apache:...
The following steps are performed on any .par files which are found within a PARInclude:
=over 4
=item * If the PARInclude is a directory, all PAR files within that directory are loaded
=item * Any .par files defined are loaded with PAR.pm, making any modules defined within
it visible to Apache
=item * Apache::PAR checks for the existence of a web.conf file within each .par archive and,
if found, includes that configuration into the main Apache configuration.
=item * If a web.conf file contains the keyword C<##UNPACKDIR##>, the contents of the
archive will be unpacked during Apache startup. The location which this is unpacked to
is controlled with the PARTempDir directive.
=item * If PerlInitHandler Apache::PAR is specified, and the contents of a PAR file change,
the archive will be reloaded (modules and content.)
=back
=head2 Some things to note:
PerlSetVar/AddVar configuration for PARInclude and PARTempDir B<MUST> be before the
PerlModule Apache::PAR (or use Apache::PAR;) line in the Apache configuration.
Any PARInclude variables (or PARDir and PARFile) after the PerlModule line will be ignored.
PARDir and PARFile directives may be used to specify the location of PAR archives, however
their use is deprecated. For new configurations, use PARInclude instead. PARInclude works
both as PARDir and PARFile by first expanding directories to include any PAR archives found
within.
The arguments for PARInclude can be either an absolute path, or a relative path from Apache's
server_root. For example, if your Apache's server_root is /usr/local/apache, and you would
like to load .par files from a parfiles/ subdirectory, use:
PerlSetVar PARInclude parfiles/
This will then look for .par files in the /usr/local/apache/parfiles directory.
The name of the configuration file which is loaded is configurable via PARConf
(default is 'web.conf'.) For example, to set the include filename to 'include.conf' for
all .par files:
PerlSetVar PARConf include.conf
The extensions used when searching for .par archives in any directories set via PARInclude
is set using the PARExt variable in the Apache configuration (the default is 'par').
For example, to set the par extension to 'zip':
PerlSetVar PARExt zip
There is currently no way to limit which .par archive a module is loaded out of. To ensure
that the correct module is being loaded, I suggest the following convention: begin module
names with the name of the archive. For instance, a MailForm module within the MyApp.par
archive should be named MyApp::MailForm
Currently, which directory inside a .par archive modules are loaded out of is not
configurable, and is the same as defined in PAR.pm:
=over 4
=item 1. /
=item 2. /lib/
=item 3. /arch/
=item 4. /i386-freebsd/ # i.e. $Config{archname}
=item 5. /5.8.0/ # i.e. $Config{version}
=item 6. /5.8.0/i386-freebsd/ # both of the above
=back
By default, if a web.conf file contains a C<##UNPACKDIR##> directive, the archive will be
unpacked to a subdirectory under PARTempDir during Apache startup. The default for
PARTempDir is the platform specific temp directory (e.g. c:\temp for win32, /tmp for *nix.)
Archive unpacking may be disabled by specifying C<PerlSetVar PARTempDir NONE> in the Apache
configuration, however this will prevent the loading of any PAR files which require
unpacking to operate.
Changed content in PAR files is not reloaded util the next restart of Apache unless the
directive C<PerlInitHandler Apache::PAR> is used. Currently, some functionality will not
change or reload when a PAR file is removed, however. This may change in a future release.
=head1 PLATFORM SPECIFIC
In general, Apache::PAR should function on most platforms without changes, as it is
(currently) a perl only module. Below are notes for any known exceptions. If you have
any problems with Apache::PAR on your platform, please contact me through one of the
methods in the CONTACT section.
( run in 1.736 second using v1.01-cache-2.11-cpan-97f6503c9c8 )