I am trying to write a "Hello World!"-like set up involving a
PerlFixupHandler but cannot get it to work. What I want to
accomplish is:
1. Configure Dispatcher.pm as a PerlFixupHandler for
http://localhost/admin.
2. Let Dispatcher.pm set ContentHandler.pm as the content
handler for that request.
3. Have ContentHandler.pm called in the corresponding phase.
but in the Apache log I see:
File does not exist: /home/fxn/prj/bw/buscawap/www/htdocs/admin
so looks like Apache is running the default handler looking under the
document root, which is /home/fxn/prj/bw/buscawap/www/htdocs.
This is mod_perl.conf:
# Just change @INC
PerlRequire /home/fxn/prj/bw/buscawap/etc/startup.pl
PerlModule Dispatcher
<Location /admin>
PerlFixupHandler Dispatcher
</Location>
Dispatcher.pm:
package Dispatcher;
use Apache::Constants ':common';
sub handler {
my $r = shift;
return DECLINED if $r->content_type ne 'text/html';
return SERVER_ERROR unless $r->can_stack_handlers;
$r->set_handlers(PerlHandler => ['ContentHandler']);
return OK;
}
1;
ContentHandler.pm:
package ContentHandler;
use Apache::Constants qw(OK);
sub handler {
my $r = shift;
$r->send_http_header('text/html');
$r->print('<html><head><title>Foo</title></head><body>Foo</body></html>');
return OK;
}
1;
What am I missing?
-- fxn