It seems you are using old documentations:
philge philip schrieb:
> Following are the scripts I tried to run.For the first script I got the
> result and it shows mod_perl is installed and running but in the second
> script am unable to load the apache module.I have also attached the part of
> the my .conf file.please help me…
>
> *Program 1:*
>
> print "Content-type: text/plain\n\n";
>
> print "Server's environment\n";
>
> foreach ( keys %ENV )
>
> {
>
> print
> "$_\t$ENV{$_}\n";
>
> }
>
> **
> *Result:*
> Server's environment
[snipp]
> MOD_PERL mod_perl/2.0.2
>
Perfect.
>
>
> *Program 2:*
>
> use Data::Dumper;
> my $r = Apache->request( );
> $r->send_http_header('text/plain');
> print Dumper(\%ENV);
>
> *Internal server error:*
> Can't locate object method "request" via package "Apache" (perhaps you
> forgot to load "Apache"?) at mod_perl2.2.pl line 2.
>
>
>
That's simply wrong:
----------------8<----------------------
use Data::Dumper;
use Apache::RequestUtil;
use Apache::RequestRec;
my $r = Apache2::RequestUtil->request;
$r->content_type('text/plain');
print Dumper(\%ENV);
----------------8<----------------------
See:
http://perl.apache.org/docs/2.0/api/ModPerl/Registry.html
or better if you are on prefork-mpm
http://perl.apache.org/docs/2.0/api/ModPerl/RegistryPrefork.html
>
> Perl .conf file
>
> * *
> * *
> LoadModule perl_module modules/mod_perl.so
> LoadModule apreq_module modules/mod_apreq2.so
>
> Alias /perl /var/www/perl
>
> <Directory /var/www/perl>
> SetHandler perl-script
> PerlResponseHandler ModPerl::Registry
> PerlOptions +ParseHeaders
> Options +ExecCGI
> </Directory>
Correct.
Tom