You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Matisse Enzer <ma...@hamparts.com> on 2003/10/14 00:49:13 UTC

mod_perl 2 - PATH_TRANSLATED, PerlResponseHandler or Filter?

What's the "right way" in mod_perl2 to find the PATH_TRANSLATED in a 
PerlRepsonsehandler?


The general situation is that i am trying to replace a CGI with a 
PerlResponsehandler. The CGI is currently used like this:

     <Location /special>
        Action text/html  /cgi-bin/handler.cgi
     </Location>

The CGI script used PATH_TRANSLATED to find out which file was 
wanted, and then applies a templating system to it, replacing 
server-side tags with database content.

Can I get access to PATH_TRANSLATED in a  PerlRepsonseHandler?

Should I use an Apache::Filter for this instead?

-- 
------------------------------------------
Matisse Enzer
Doodlelab Inc.
415-925-5294 ext. 212 (office)
415-225-6703 (mobile)

Re: mod_perl 2 - Contributing to documentation

Posted by Stas Bekman <st...@stason.org>.
Matisse Enzer wrote:
> At 11:51 AM -0700 10/14/03, Stas Bekman wrote:
> 
>>
>> And if you have learned something on this list that is not documented, 
>> documented but can't be found easily, remember that patches are very 
>> welcome. If everyone who was helped here had contributed back a doc 
>> patch, the docs would be in a much better state.
> 
> 
> I will start doing that.

Thanks Matisse

> If I wanted to add an entry for   $r->filename   would I modify 
> RequestUtil.pod.orig and send the modified document to the docs-dev 
> mailing list?

If you do that once it'll work, though it might be out of sync with the latest 
version (the online version is synced every 6 hours).

But in the long run, we have a cvs repository for docs. So when you patch 
something it's the best to send the patch against the source files in that 
repository. Here is how to get it:
http://perl.apache.org/download/docs.html
e.g. to contribute to RequestUtil.pod, you'd modify 
modperl-docs/src/docs/2.0/api/Apache/RequestUtil.pod
then do:
cvs diff -u src/docs/2.0/api/Apache/RequestUtil.pod
and send the diff here or to the docs-dev list:
http://perl.apache.org/maillist/docs-dev.html

Thanks.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


mod_perl 2 - Contributing to documentation

Posted by Matisse Enzer <ma...@hamparts.com>.
At 11:51 AM -0700 10/14/03, Stas Bekman wrote:
>
>And if you have learned something on this list that is not 
>documented, documented but can't be found easily, remember that 
>patches are very welcome. If everyone who was helped here had 
>contributed back a doc patch, the docs would be in a much better 
>state.

I will start doing that.

If I wanted to add an entry for   $r->filename   would I modify 
RequestUtil.pod.orig and send the modified document to the docs-dev 
mailing list?
-- 
------------------------------------------
Matisse Enzer
Doodlelab Inc.
415-925-5294 ext. 212 (office)
415-225-6703 (mobile)

Re: mod_perl 2 - PATH_TRANSLATED, PerlResponseHandler or Filter?

Posted by Stas Bekman <st...@stason.org>.
Geoffrey Young wrote:
> 
> 
> Matisse Enzer wrote:
> 
>> Thank you very nice!
>>
>> Where should I have looked to figure this out myself?
[...]
> also from the eagle book and cookbook, if you're familiar with the 1.0 
> API.  I wasn't sure if this still worked in 2.0, however, but the docs I 
> mentioned are
> 
> http://perl.apache.org/docs/2.0/user/config/config.html#C_SetHandler_

And if you have learned something on this list that is not documented, 
documented but can't be found easily, remember that patches are very welcome. 
If everyone who was helped here had contributed back a doc patch, the docs 
would be in a much better state.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: mod_perl 2 - PATH_TRANSLATED, PerlResponseHandler or Filter?

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

Matisse Enzer wrote:
> Thank you very nice!
> 
> Where should I have looked to figure this out myself?


>> if you're using the mod_perl API, you can get PATH_TRANSLATED by 
>> joining $r->filename and $r->path_info.  

from lots of places, like the eagle book and cookbook.

>> according to the docs, 
>> calling $r->subprocess_env in a void context will populate standard 
>> CGI variables in  $r->subprocess_env();

also from the eagle book and cookbook, if you're familiar with the 1.0 API. 
  I wasn't sure if this still worked in 2.0, however, but the docs I 
mentioned are

http://perl.apache.org/docs/2.0/user/config/config.html#C_SetHandler_

>>
>> if it's a normal CGI script, if you use the perl-script handler, or 
>> the modperl handler with PerlOptions +SetupEnv, you should be able to 
>> get at it via %ENV.

see above.

HTH

--Geoff


Re: mod_perl 2 - PATH_TRANSLATED, PerlResponseHandler or Filter?

Posted by Matisse Enzer <ma...@hamparts.com>.
Thank you very nice!

Where should I have looked to figure this out myself?

At 11:00 PM -0400 10/13/03, Geoffrey Young wrote:
>Matisse Enzer wrote:
>>
>>Can I get access to PATH_TRANSLATED in a  PerlRepsonseHandler?
>
>if you're using the mod_perl API, you can get PATH_TRANSLATED by 
>joining $r->filename and $r->path_info.  according to the docs, 
>calling $r->subprocess_env in a void context will populate standard 
>CGI variables in  $r->subprocess_env();
>
>if it's a normal CGI script, if you use the perl-script handler, or 
>the modperl handler with PerlOptions +SetupEnv, you should be able 
>to get at it via %ENV.
>
>HTH
>
>--Geoff


-- 
------------------------------------------
Matisse Enzer
Doodlelab Inc.
415-925-5294 ext. 212 (office)
415-225-6703 (mobile)

Re: mod_perl 2 - PATH_TRANSLATED, PerlResponseHandler or Filter?

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

Matisse Enzer wrote:
> What's the "right way" in mod_perl2 to find the PATH_TRANSLATED in a 
> PerlRepsonsehandler?
> 
> 
> The general situation is that i am trying to replace a CGI with a 
> PerlResponsehandler. The CGI is currently used like this:
> 
>     <Location /special>
>        Action text/html  /cgi-bin/handler.cgi
>     </Location>
> 
> The CGI script used PATH_TRANSLATED to find out which file was wanted, 
> and then applies a templating system to it, replacing server-side tags 
> with database content.
> 
> Can I get access to PATH_TRANSLATED in a  PerlRepsonseHandler?

if you're using the mod_perl API, you can get PATH_TRANSLATED by joining 
$r->filename and $r->path_info.  according to the docs, calling 
$r->subprocess_env in a void context will populate standard CGI variables in 
  $r->subprocess_env();

if it's a normal CGI script, if you use the perl-script handler, or the 
modperl handler with PerlOptions +SetupEnv, you should be able to get at it 
via %ENV.

HTH

--Geoff