I've been hacking on a PAR resolver, too. My approach differs in a
couple of ways, mostly because I had a slightly different conception
of what the resolver should do. My requirements:
1) Alias specific URI paths to specific PAR files, with possibly
multiple paths pointing to a single archive.
2) Allow files in the filesystem to "shadow" components in the PAR
files, so that PAR-bundled applications can be selectively
customized. (Really, any kind of component resolution should work
for shadowing -- not just traditional filesytem resolution --
since the code just punts to SUPER if it looks like SUPER can
find a valid component, and an arbritrary parent class can be
specified at import time.)
3) Make directory slash-redirection and DirectoryIndex file serving
work as expected <laugh>. I was just starting to work on this
when you posted your question to the list last week. After
several days of hacking (and printf'ing mod_dir.c, mod_mime.c and
friends), things seem to be working. The linchpin is a
PerlTransHandler, which itself selectively activates a
PerlTypeHandler and a PerlFixupHandler.
The source for my (also still in-progress) resolver is available from:
http://xml-comma.org/dist/latest-by-file/Comma/Pkg/Mason/ParResolver.pm
Configuration requires telling Apache about the trans handler:
PerlTransHandler XML::Comma::Pkg::Mason::ParResolver::trans_handler
and something like the following in a handler.pl:
use XML::Comma::Pkg::Mason::ParResolver
par_paths => { '/par_test' => '/allafrica/webtree/test.par',
'/par2' => '/allafrica/webtree/test.par' };
my $ah = HTML::Mason::ApacheHandler->new
(
comp_root => '/allafrica/webtree',
resolver_class => 'XML::Comma::Pkg::Mason::ParResolver',
data_dir => '/usr/local/apache/mason_data',
error_mode => 'output',
);
The resolver looks for components in a top-level 'mason' directory in
the PAR files.
My ultimate goal is to support self-contained, bundled
XML::Comma/HTML::Mason-based web applications. Comma knows how to
resolve data defs from a PAR file, these resolvers let Mason fetch
components from a PAR file, and PAR.pm already makes it possible to
load perl modules from PAR files -- that's all you need!
Since this is being cross-posted to the PAR list, I'd like to take the
opportunity to thank Autrijus for a really nifty (and powerful) tool.
Kwin