On 14 May 2000, (Randal L. Schwartz) wrote:
>
> It always bugged me that for a PerlHandler, I needed to set *two*
> things... both the SetHandler and the PerlHandler.
>
> I have this idea that a good generic PerlFixupHandler would fix that.
> Instead of setting the mime-type to "text/html", we'd set the
> mime-type to "text/html;Apache::Registry" for those directories that
> wanted Registry mangling, or "text/html;HTML::Mason" for Mason, etc.
> That of course would skate through the standard MIME phase being
> unmatched, and the Fixup handler would see the semicolon, rip out the
> second part as a Perl handler, and unshift the handler while setting
> the handler to perl-script. So, I'd merely have to do things like
>
> AddHandler text/html;HTML::Mason .htm .html
You mean AddType here I think...
> at the top level. And if I wanted a particular file not to be Mason,
> I could wrap it:
>
> <Files col*.html>
> ForceType text/html
> </Files>
Why not again just:
<Files col*>
AddType text/html .html
</Files>
> I bet mod_mime_magic could even then be used to reach inside a file
> and intuit the right PerlHandler based on content. And stacking would
> be easy:
>
> AddType text/html;Apache::OutputChain;Apache::SSIChain
>
> Any thoughts on this? Am I confused to think that MIME phase would
> not get in the way? Or should this go ahead of the core MIME so that
> it can do some magic redirection as well? For that, I think I'd
> like PerlTypeHandler ahead of the core MIME that can do stuff like this:
>
> PerlSetVar ReType 'text/(plain|html)=text/html;Apache::Registry'
>
> and then anything that made it to here that looks text/plain or text/html
> really gets mapped to Registry.
>
> Thoughts? Am I trying to be too generic? I like useful frameworks. :)
Nah - go for it. AxKit's XMLFinder does something pretty similar, only in
not quite as generic a way, so it would be perfectly possible.
--
<Matt/>
Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org http://xml.sergeant.org