On Thu, 27 Jan 2000, Jim Winstead wrote:
> Is there a way to set a PerlHandler for a specific MIME type?
> Something like "PerlTypeHandler text/html HTML::Template"?
> (Yes, I know I can use a <Files> section. Not quite as slick,
> and that mucks up $r->location.)
there's no builtin config like that, though you could to magic with
directive handlers. otherwise, something like this should work:
package My::MimeTypeDispatch;
my %mime_types = (
'text/html' => \&HTML::Template::handler,
);
sub handler {
my $r = shift;
if (my $h = $mime_types{$r->content_type}) {
$r->push_handlers(PerlHandler => $h);
$r->handler('perl-script');
}
}
__END__
PerlFixupHandler My::MimeTypeDispatch