You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Alexander Hanuska <ah...@cisco.com> on 2002/03/19 18:40:46 UTC

Forgot to load Apache::Request?

I am trying to call the Apache::Request module from one of my modules that 
I wrote and here is the error I get in my error_log:

Can't locate object method "new" via package "Apache::Request" blablabla

I was browsing though the mod_perl archives and found a similar post, so I 
checked to make sure my module is running in mod_perl mode:

print "not " unless $ENV{MOD_PERL};
print "running under mod_perl.\n";

So I am running under mod_perl.  I tried changing the order of loading the 
PerlModules in my httpd.conf file, but that did not help.

I am running perl-5.6.1, mod_perl-1.26, apache-1.3.23 mod_ssl-2.8.7 
openssl-0.9.6c all compiled as DSO on linux kernel-2.4.17

my module starts as follows:

use Apache::File();
use Apache::Request;
use Apache::Constants qw (:common);

sub handler {
   my $r = shift;
   my $apr = Apache::Request->new($r);
  etc...

httpd.conf to go with it:

<Location /my_module>
   SetHandler perl-script
   PerlHandler my_module_dir::my_module
</Location>

Any ideas?  Any help is appreciated!

Alex


Re: Forgot to load Apache::Request?

Posted by Alexander Hanuska <ah...@cisco.com>.
Geoff,

Thanks for your answer.  I had installed the libapreq package and I had 
tried to pre-load the module in my httpd.conf file, and apache started up 
with no complaints.  Even using the standard: perl -e "use Apache::Request" 
seems to like the Request module.  Maybe I'll have to pay more attention to 
my httpd.conf file or just drop the Apache::Request module altogether.

If anyone has suggestions...Please let me know.

Thank you in advance,

Alex

At 12:44 PM 3/19/2002 -0500, Geoffrey Young wrote:
>Alexander Hanuska wrote:
> >
> > I am trying to call the Apache::Request module from one of my modules that
> > I wrote and here is the error I get in my error_log:
> >
> > Can't locate object method "new" via package "Apache::Request" blablabla
>
>looks like you are doing everything right...
>
>you know Apache::Request isn't part of the standard mod_perl
>distribution, right?  you need to install the libapreq package:
>
>http://cpan.valueclick.com/modules/by-module/Apache/libapreq-1.0.tar.gz
>
>a good way to make sure you have everything is to preload your
>modules, either with a startup.pl or a PerlModule statement - that way
>Apache won't start if mod_perl can't find what it needs.
>
>HTH
>
>--Geoff

Alexander Hanuska
Network Analyst

Cisco Systems, Inc.
170 West Tasman Drive
San Jose, CA 95134-1706 USA
(408) 853-2657
ahanuska@cisco.com
ahanuska@epage.cisco.com


Re: Forgot to load Apache::Request?

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
Alexander Hanuska wrote:
> 
> I am trying to call the Apache::Request module from one of my modules that
> I wrote and here is the error I get in my error_log:
> 
> Can't locate object method "new" via package "Apache::Request" blablabla

looks like you are doing everything right...

you know Apache::Request isn't part of the standard mod_perl
distribution, right?  you need to install the libapreq package:

http://cpan.valueclick.com/modules/by-module/Apache/libapreq-1.0.tar.gz

a good way to make sure you have everything is to preload your
modules, either with a startup.pl or a PerlModule statement - that way
Apache won't start if mod_perl can't find what it needs.

HTH

--Geoff