[cgiapp] Location not found with CGI::Application::Dispatch under mod_perl V 2

Michael Peters mpeters at plusthree.com
Mon Sep 1 10:06:21 EDT 2008


Ron Savage wrote:

> use CGI::Application::Plugin::Apache;

Just a word of warning about C::A::P::Apache. The idea was that 
$self->query would return an Apache::Request object instead of a CGI.pm 
object. This would make things faster and use less memory. But so many 
other C::A plugins assume that $self->query is a CGI.pm object that if 
you use CAP::Apache with other plugins things break in weird ways. So, 
as the author of CAP::Apache, I'd warn against using it if you want to 
use any other C::A plugins. If you just want to use it by itself, it 
should be fine though.

> <Location /local>
> 	SetHandler perl-script
> 	PerlResponseHandler CGI::Application::Dispatch
> 	PerlSetVar CGIAPP_DISPATCH_PREFIX Local
> </Location>

You can use C::A::Dispatch as the handler if you want, but I would 
recommend that you subclass it and create your own dispatch table in 
your subclass. It's much easier to control things.

> (4)
> I'm hoping to hit http://127.0.0.1/local/sites and have
> CGI::Application::Dispatch fire up Local::Sites, but I get:
> Not Found
> The requested URL /local/sites was not found on this server.

Not Found is what Dispatch returns when it either can't translate the 
PATH_INFO into a module name or can't find the module.

> (5)
> There is nothing in logs/error_log, and only this in logs/access_log:
> 127.0.0.1 - - [01/Sep/2008:15:01:18 +1000] "GET /local/sites HTTP/1.1"
> 404 209
> 
> Is the problem that the docs for CGI::Application::Dispatch are Apache
> V1 oriented, and that something different needs to be done for V2?

It should work with V2. Try setting debug to true in your subclass and 
see what happens. Or can set it within apache's config using 
CGIAPP_DISPATCH_DEBUG (I just realized this isn't documented)

   PerlSetVar CGIAPP_DISPATCH_PREFIX 1

-- 
Michael Peters
Plus Three, LP



More information about the cgiapp mailing list