Empty $r in mod_perl

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Dear All,

I installed mod_perl 2 (static mod) in my linux, however, seems the
perl script cannot invoke the mod_perl's function. anyone can give me
some ideaa on the problem? My purpose of using mod_perl is the get the
full header of all HTTP request to Apache. Thank you so much! Below is
the scenario:

- Fedora 3
- Apache 2.2.3
- Perl 5.8.8

I added the following in httpd.conf:
PerlModule Apache2::Registry
<Directory "/usr/local/apache2/htdocs">
      Options Indexes FollowSymLinks ExecCGI
      PerlHandler Apache2::Registry
      PerlSendHeader On

When apache starts, the error_log shows:
[Sat Jan 06 18:43:54 2007] [notice] Apache/2.2.3 (Unix) mod_perl/2.0.3
Perl/v5.8.8 configured -- resuming normal operations

My perl script in "/usr/local/apache2/htdocs/test1.pl":
use strict;
my $r = shift;
$r->print("It worked!!!\n");

The following error in error_log:
[Sat Jan 06 18:44:32 2007] [error] [client] Can't call
method "print" on an undefined value at
/usr/local/apache2/htdocs/test1.pl line 8.


Re: Empty $r in mod_perl

jason.yfho@gmail.com schrieb:
Quoted text here. Click to load it

I had to do this in my Apache2 handler:

 require Apache2::RequestUtil;

 $r->print("It worked!!!\n");

Maybe it works for you.
Thomas Wittek
http://gedankenkonstrukt.de /
Jabber: streawkceur@jabber.i-pobox.net

Site Timeline