Re: passing Apache::Request object
Marc Lambrichs wrote: Hi All, I want to save my Apache::Request object in an PerlInitHandler called Initialization and later on during the life cycle of the request call a Initialization-get_request() method to use it again. perldoc Apache::Request: instance The instance() class method allows Apache::Request to be a singleton. This means that whenever you call Apache::Request-instance() within a single request you always get the same Apache::Request object back. This solves the problem with creating the Apache::Request object twice within the same request - the symptoms being that the second Apache::Request object will not contain the form parameters because they have already been read and parsed. my $apr = Apache::Request-instance($r, DISABLE_UPLOADS = 1); [... more in the manpage ...] __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
passing Apache::Request object
Hi All, I want to save my Apache::Request object in an PerlInitHandler called Initialization and later on during the life cycle of the request call a Initialization-get_request() method to use it again. How can I do this in a safe manner? If you're wondering, why I would want to do this, take a look at Perrin Harkins perl.com article about etoys. Cheers, Marc
Apache request object
How can I access the Apache Request object from a Perl package that I am calling from a Perl Authorization handler? Example: Package TestPackage.pm --- Package Apache::TestPackage.pm @EXPORT qw ($home_url); my $home_url = "http:" . "//" . $ENV{'SERVER_NAME'}; 1; --- Handler TestHandler.pm --- Package Apache::TestHandler.pm use Apache::TestPackage.pm sub handler() { my $r = shift; $r-log_error("Home URL = $home_url"); return OK; } 1; - When I use the handler above, the $home_url does not print out because the $ENV{'SERVER_NAME'} has not been set at the time that the TestHandler is called. I tried using the following code in TestPackage.pm: my $r = Apache-request(); my $s = $r-server; but the error I get is: Can't call method "server" on an undefined value. I also tried using the server_name() function from CGI, but that also relies on the $ENV{'SERVER_NAME'} as well. I get $home_url = "localhost" when I call that function from the Package. Thanks, Gene Dascher
Re: Apache::ASP and Apache request object
Dmitry Beransky wrote: Hi, In order to get an instance of Apache::Session, I need to get to the current session id which is stored in a request header, which means I need to get a reference to the current apache request object. I've browsed through Apache::ASP code and docs and realized that there is no documented API for accessing the underlying request, but I can still do it by accessing the internal structures directly: $sessionID = $self-{'asp'}-{'r'}-header_in('sessionID'); So my question is: how reliable this method is? Can I assume that the structure of the ASP and GlobalASA will not change in the future? You can get the current request like Apache-header_in('sessionID') So this doesn't rely on ASP internals, you'll be fine. --Joshua
RE: where to find info on the Apache request object
-Original Message- From: Sam Carleton [mailto:[EMAIL PROTECTED]] Sent: Sunday, April 30, 2000 2:08 PM To: mod_perl Subject: Re: where to find info on the Apache request object Jeff Beard wrote: Or read chapter 9 in the Eagle book. --Jeff At 10:43 AM 4/30/00, Tobias Hoellrich wrote: At 01:34 PM 4/30/00 -0400, Sam Carleton wrote: I am learning perl/mod_perl right now and have some questions. I would like to see all the functions that I can call on the Apache request object. Can anyone point me to some documentation? I didn't see a listing in "Writing Apache Modules in Perl and C". Sam try 'perldoc Apache' Tobias and Jeff, Thanks for the pointer, but now I am looking for info on the Apache::Request object, I did not see it in Chapter 9 of the Eagle book. I tried a number of different ways of trying to get to it from perldoc, but failed. How do I go about bring up the doc on this in perldoc? Apache::Request is part of the libapreq package under the apache tree on CPAN: http://www.perl.com/CPAN-local/modules/by-module/Apache/libapreq-0.31.tar.gz install that, then 'perldoc Apache::Request' is all you need... HTH --Geoff Sam
where to find info on the Apache request object
I am learning perl/mod_perl right now and have some questions. I would like to see all the functions that I can call on the Apache request object. Can anyone point me to some documentation? I didn't see a listing in "Writing Apache Modules in Perl and C". Sam
Re: where to find info on the Apache request object
Or read chapter 9 in the Eagle book. --Jeff At 10:43 AM 4/30/00, Tobias Hoellrich wrote: At 01:34 PM 4/30/00 -0400, Sam Carleton wrote: I am learning perl/mod_perl right now and have some questions. I would like to see all the functions that I can call on the Apache request object. Can anyone point me to some documentation? I didn't see a listing in "Writing Apache Modules in Perl and C". Sam try 'perldoc Apache' Tobias Jeff Beard _ Web:www.cyberxape.com Email: jeff at cyberxape.com Location: Boulder, CO, USA
Re: where to find info on the Apache request object
Jeff Beard wrote: Or read chapter 9 in the Eagle book. --Jeff At 10:43 AM 4/30/00, Tobias Hoellrich wrote: At 01:34 PM 4/30/00 -0400, Sam Carleton wrote: I am learning perl/mod_perl right now and have some questions. I would like to see all the functions that I can call on the Apache request object. Can anyone point me to some documentation? I didn't see a listing in "Writing Apache Modules in Perl and C". Sam try 'perldoc Apache' Tobias and Jeff, Thanks for the pointer, but now I am looking for info on the Apache::Request object, I did not see it in Chapter 9 of the Eagle book. I tried a number of different ways of trying to get to it from perldoc, but failed. How do I go about bring up the doc on this in perldoc? Sam