package Book::MimeTypeDispatch; use Apache::Constants qw(DECLINED); my %mime_types = ( 'text/html' => \&HTML::Template::handler, 'text/plain' => \&Book::Text::handler, ); sub handler { my $r = shift; if (my $h = $mime_types{$r->content_type}) { $r->push_handlers(PerlHandler => $h); $r->handler('perl-script'); } return DECLINED; } 1; __END__