Re: [cgiapp] CGI::Application::Dispatch help

2009-01-14 Thread Michael Peters

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


#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




Re: [cgiapp] CGI::Application::Dispatch help

2009-01-14 Thread fREW Schmidt
 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.

Ok, you're definitely right about that.  Apache just completely drops
that first bit, which was expected


 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).

Because I didn't know how to do it another way? :-)  I updated it to this:

Location  /abc
   SetHandler perl-script
   PerlHandler ACD::Dispatch
AllowOverride None
Order allow,deny
Allow from all
/Location

Note: The following has been there all along:
ScriptAlias /abc /path/to/abc

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

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

You are correct.

 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 ''.

You are correct.

 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

You are correct.

 Go to:
 localhost/abc/jkfldjskljfdkls/home_othercontroller/some_rm
 Get:
 Home/OtherController, some_rm
 Similar to the above.

You are correct.

 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.

Ok, abc has actually always been an alias for a longer name and never
really did exist.  Or is an alias the same?

 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.

I figured this one out.  The problem was that I had the rule
':app/:rm' = {} and it should have been ':app/:rm?' = {}.

Thanks for all of your help, I really appreciate it.

-fREW

#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####