[cgiapp] CGI::Application::Dispatch help

Michael Peters mpeters at plusthree.com
Wed Jan 14 09:11:01 EST 2009


fREW Schmidt wrote:

> I am a little confused about how CAD is supposed to work I guess.

Let's see if we can help...

> First off, I have a directory, call it abc. 

That right there is kind of a red-flag. Not that you're doing anything wrong, but Apache has a weird 
notion of PATH_INFO when a real directory exists. And Dispatch relies on PATH_INFO for parsing. You 
can check what Apache thinks it is by printing the $ENV{PATH_INFO} in your Dispatch.pm.

> I think this is all you might need to see from there:
> 
> <Directory  "c:/path/to/abc">
>    SetHandler perl-script
>    PerlHandler ACD::Dispatch
>     AllowOverride None
>     Order allow,deny
>     Allow from all
> </Directory>

Why are you using a Directory for this? I'm not sure if that affects what Apache does with PATH_INFO 
or not, but I usually use a Location. Especially since your not serving things out of that directory 
directly (instead you're using ACD::Dispatch to provide a "virtual" directory).

> Ok, so here is what has been happening:
> 
> Go to:
> localhost/abc/
> Get:
> Home, welcome

What is PATH_INFO here? I would expect it to be ''

> Go to:
> localhost/abc/fdjksalfdsafdsa
> Get:
> Home, welcome

What is PATH_INFO here? It looks like it should be 'fdjksalfdsafdsa', but Dispatch looks like it's 
behaving with a PATH_INFO of ''.

> Go to:
> localhost/abc/jkfldjskljfdkls/home_othercontroller
> Get:
> Error'd

Again, PATH_INFO looks like it should be 'jkfldjskljfdkls/home_othercontroller' but Dispatch behaves 
like it's "home_othercontroller"

> Go to:
> localhost/abc/jkfldjskljfdkls/home_othercontroller/some_rm
> Get:
> Home/OtherController, some_rm

Similar to the above.

> So I guess my questions are: why is it ignoring that first directory? 

I think you've hit on a weirdism of Apache changing the PATH_INFO if the real directory (in this 
case "abc") exists. Try changing the directory name to something else and see if that changes anything.

> And
> do I actually have to put the startrunmode in the dispatcher?  It seems to
> be ignoring the one set in OtherController.pm.

No, the start run mode should be executed if no run mode is given in the PATH_INFO. Try turning on 
debugging and see if you can get any more information.

-- 
Michael Peters
Plus Three, LP



More information about the cgiapp mailing list