You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Foo Ji-Haw <jh...@nexlabs.com> on 2005/05/03 04:44:45 UTC
Re: [mp2] Problems with Apache::Request
Let me see if I can answer this one.
Your sample code does not use Apache::Request at all. by the way, in the
latest release of modperl RC5, Apache::Request is now renamed to
Apache2::Request. You probably can guess why.
If you wish to use the Apache::Request object, you need to first load
the module in httpd.conf. It should look like this:
LoadModule apreq_module bin/mod_apreq.so
If you choose to upgrade to the latest modperl, use this:
LoadModule apreq_module bin/mod_apreq2.so
Note that the path is bin/mod...Change it to modules/mod_apreq.so if
that is where the .so file is.
As usual, reload Apache to once you have the line in.
Stephen Quinney wrote:
>I've been having problems with the Apache::Request module (from
>libapreq2) and mod_perl2 for a while now and I've not come up with a
>decent solution. I am using the Debian packages but I didn't get a
>response from the maintainer so I hope someone here can enlighten me.
>
>This is with libapreq2-2.04_03-dev and mod_perl2 1.999.21-1 but I've
>had similar problems with earlier versions.
>
>I have a very simple mod_perl handler:
>
>package Jadevine::Hello;
>
>use Apache2;
>use Apache::RequestRec ();
>use Apache::RequestIO ();
>use Apache::Request ();
>use Apache::Const -compile => qw(OK);
>
>sub handler {
> my $r = shift;
> $r->content_type('text/plain');
> print "mod_perl 2.0 rocks!\n";
> return Apache::OK;
>}
>1;
>
>This is loaded in the Apache config with:
>
> <Location /Hello>
> SetHandler perl-script
> PerlResponseHandler Jadevine::Hello
> </Location>
>
>If I remove the "use Apache::Request" line everything works
>fine. Leaving it there, or actually trying to use the methods provided
>by the module give the error:
>
>[error] [client 127.0.0.1] failed to resolve handler `Jadevine::Hello': Apache::Request: httpd must load mod_apreq.so first at /usr/lib/perl5/Apache2/Apache/Request.pm line 31.\nCompilation failed in require at /usr/local/lib/site_perl/Jadevine/Hello.pm line 5.\nBEGIN failed--compilation aborted at /usr/local/lib/site_perl/Jadevine/Hello.pm line 5.\nCompilation failed in require at (eval 3) line 3.\n
>
>I have tried putting the "use" statements in every order imaginable
>without any joy so I'm not sure what the error is trying to get me to
>do to correct the problem.
>
>I can see where the error comes from in the Apache::Request code:
>
> my $env = __PACKAGE__->env || '';
> if ($mod_perl::VERSION > 1.99) {
> die __PACKAGE__ . ": httpd must load mod_apreq.so first"
> if $env ne "Apache::RequestRec";
> }
>
>For the record $env contains 'APR::Pool', not sure if this is what
>should be there or not.
>
>Any help would be much appreciated, thanks in advance,
>
>Stephen Quinney
>
>
>
>