Empty $r in mod_perl



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:


System:
- 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
.......
</Directory>


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":
#!/usr/local/bin/perl5.8.8
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 192.168.1.35] Can't call
method "print" on an undefined value at
/usr/local/apache2/htdocs/test1.pl line 8.


Regards,
Jason

.



Relevant Pages

  • $r not work in mod_perl 2
    ... perl script cannot invoke the mod_perl's function. ... some ideaa on the problem? ... full header of all HTTP request to Apache. ...
    (comp.lang.perl.misc)
  • Re: Calling a perl script from an html doc
    ... > created as html files on a linux server, and they pop up in IE6 on our local ... Maybe you need to re-think this and write a perl script that collects the data ... You can use CGI with the Apache webserver and execute perl scripts either by ...
    (comp.lang.perl.misc)
  • Re: HOW to rename a NPH script ?
    ... On Fri, 18 Aug 2006, Sherm Pendley wrote: ... I want the PERL script to tell apache, ... you cannot do that from inside the Perl script. ... but not for the user's browser. ...
    (comp.lang.perl.misc)
  • Re: PHP in a Perl Script
    ... > except that the perl script also writes out some PHP processing. ... I assume this is on Apache ... ...
    (comp.lang.perl.misc)
  • Re: Making a .php page a .cgi page
    ... > Perl script yet ends in .cgi Apache is saying "Exec format error: ...
    (comp.lang.php)