You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Lev Lvovsky <li...@sonous.com> on 2007/10/25 00:40:21 UTC

SCRIPT_NAME & PATH_INFO %ENV variables

judging by this thread:

http://www.mail-archive.com/modperl@apache.org/msg15609.html

This might be an old question but I'm not entirely sure I understand  
the answer spelled out in the response.

I have the following Location setting in my httpd.conf (via an  
include file):
<Location /mod_perl>
SetHandler perl-script
PerlResponseHandler mod_perl::Test
</Location>

hits to various related urls result in the following:

http://localhost/mod_perl/
SCRIPT_NAME = /mod_perl
PATH_INFO = /

http://localhost/mod_perl/test1
SCRIPT_NAME = /mod_perl
PATH_INFO = /test1

http://localhost/mod_perl/test1/test2
SCRIPT_NAME = /mod_perl
PATH_INFO = /test1/test2

when using CGI.pm and the url(relative => 1) method, always results  
in 'mod_perl', as opposed to the basename (for lack of a better word)  
in SCRIPT_NAME.

Is there any way to get have the url() method get the SCRIPT_NAME  
defined by the regex: s|/.*/(.*)|$1| (that may not account for all  
possibilities, but close enough for an example)

Thanks,
-lev

Re: SCRIPT_NAME & PATH_INFO %ENV variables

Posted by Lev Lvovsky <li...@sonous.com>.
On Oct 24, 2007, at 9:01 PM, Randy Kobes wrote:

> I misunderstood your question - I thought you were trying
> to do this just under mod_perl, without CGI.pm. The
> CGI::Apache2::Wrapper package and CGI.pm are intended
> to give the same results, assuming the tests pass:
>  http://search.cpan.org/src/RKOBES/CGI-Apache2-Wrapper-0.21/t/ 
> response/TestCGI/misc.pm
> If none of the CGI.pm options to url() give what you need,
> you may want to ask the author of CGI.pm, Lincoln Stein, about the  
> background for the present behavior.
>
> -- 
> best regards,
> Randy

Thanks for your help Randy, I installed your package, and as you  
stated, it gives the same results as CGI.pm, which from the looks of  
it seem to make sense - I'll getting clarification on the "problem".

Thanks again,
-lev

Re: SCRIPT_NAME & PATH_INFO %ENV variables

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Wed, 24 Oct 2007, Lev Lvovsky wrote:

> On Oct 24, 2007, at 4:31 PM, Randy Kobes wrote:
>> The code in CGI::Apache2::Wrapper:
>> http://cpan.uwinnipeg.ca/htdocs/CGI-Apache2-Wrapper/CGI/Apache2/Wrapper.pm.html#Apache2_URI
>> provides a CGI-compatible url() method based on
>> Apache2::URI:
>>  http://cpan.uwinnipeg.ca/htdocs/mod_perl/Apache2/URI.html
>
> Hi Randy, thanks for the reference.  Is there no other way to get these same 
> results via the CGI.pm package?  I would be a lot more eager to use the 
> Wrapper package if there was some sort of explanation as to why CGI.pm 
> doesn't work in it's current state - we're using the CGI package in a lot of 
> our code, and I'm not sure that the Wrapper package has all of the backwards 
> compatibility that we need.

I misunderstood your question - I thought you were trying
to do this just under mod_perl, without CGI.pm. The
CGI::Apache2::Wrapper package and CGI.pm are intended
to give the same results, assuming the tests pass:
  http://search.cpan.org/src/RKOBES/CGI-Apache2-Wrapper-0.21/t/response/TestCGI/misc.pm
If none of the CGI.pm options to url() give what you need,
you may want to ask the author of CGI.pm, Lincoln Stein, 
about the background for the present behavior.

-- 
best regards,
Randy

Re: SCRIPT_NAME & PATH_INFO %ENV variables

Posted by Lev Lvovsky <li...@sonous.com>.
On Oct 24, 2007, at 4:31 PM, Randy Kobes wrote:
> The code in CGI::Apache2::Wrapper:
>  http://cpan.uwinnipeg.ca/htdocs/CGI-Apache2-Wrapper/CGI/Apache2/ 
> Wrapper.pm.html#Apache2_URI
> provides a CGI-compatible url() method based on
> Apache2::URI:
>   http://cpan.uwinnipeg.ca/htdocs/mod_perl/Apache2/URI.html

Hi Randy, thanks for the reference.  Is there no other way to get  
these same results via the CGI.pm package?  I would be a lot more  
eager to use the Wrapper package if there was some sort of  
explanation as to why CGI.pm doesn't work in it's current state -  
we're using the CGI package in a lot of our code, and I'm not sure  
that the Wrapper package has all of the backwards compatibility that  
we need.

thanks!
-lev

Re: SCRIPT_NAME & PATH_INFO %ENV variables

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Wed, 24 Oct 2007, Lev Lvovsky wrote:

> judging by this thread:
>
> http://www.mail-archive.com/modperl@apache.org/msg15609.html
>
> This might be an old question but I'm not entirely sure I understand the 
> answer spelled out in the response.
>
> I have the following Location setting in my httpd.conf (via an include file):
> <Location /mod_perl>
> SetHandler perl-script
> PerlResponseHandler mod_perl::Test
> </Location>
>
> hits to various related urls result in the following:
>
> http://localhost/mod_perl/
> SCRIPT_NAME = /mod_perl
> PATH_INFO = /
>
> http://localhost/mod_perl/test1
> SCRIPT_NAME = /mod_perl
> PATH_INFO = /test1
>
> http://localhost/mod_perl/test1/test2
> SCRIPT_NAME = /mod_perl
> PATH_INFO = /test1/test2
>
> when using CGI.pm and the url(relative => 1) method, always results in 
> 'mod_perl', as opposed to the basename (for lack of a better word) in 
> SCRIPT_NAME.
>
> Is there any way to get have the url() method get the SCRIPT_NAME defined by 
> the regex: s|/.*/(.*)|$1| (that may not account for all possibilities, but 
> close enough for an example)

The code in CGI::Apache2::Wrapper:
  http://cpan.uwinnipeg.ca/htdocs/CGI-Apache2-Wrapper/CGI/Apache2/Wrapper.pm.html#Apache2_URI
provides a CGI-compatible url() method based on
Apache2::URI:
   http://cpan.uwinnipeg.ca/htdocs/mod_perl/Apache2/URI.html

-- 
best regards,
Randy Kobes