You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Max Kanat-Alexander <mk...@bugzilla.org> on 2006/07/22 02:48:46 UTC

Startup script throwing error about $r when it shouldn't

	When I start Apache, I get this:

Global $r object is not available. Set:\n\tPerlOptions +GlobalRequest\nin httpd.conf at /var/www/html/mod_perl/Bugzilla.pm line 316.

	Okay...that's from my startup script (I cut out most of the error
message to make things clearer.)

	But here's that line:

sub request_cache {
    if ($ENV{MOD_PERL}) {
        require Apache2::RequestUtil;
316:    my $request = Apache2::RequestUtil->request;
        my $cache = $request->pnotes();


	It's inside a subroutine! And it's called dynamically! And that
subroutine is never called at compile time!

	So why in the world is mod_perl complaining?

	-Max
-- 
http://www.everythingsolved.com/
Competent, Friendly Bugzilla Services. And Everything Else, too.


Re: Startup script throwing error about $r when it shouldn't

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
> sub request_cache {
>     if ($ENV{MOD_PERL}) {
use Carp;
confess shift;
>         require Apache2::RequestUtil;
> 316:    my $request = Apache2::RequestUtil->request;
>         my $cache = $request->pnotes();

tail -f error_log
apachectl restart

thats how....  I'm guessing there is some code not wrapped in a function that calls this function
which is getting sucked in at startup via a PerlModule, require, or use elsewhere.  At anyrate, the stack trace will
tell all.

grep -l request_cache *
Bugzilla/BugMail.pm
Bugzilla/Template.pm
Bugzilla.pm

grep request_cache * |wc -l
      38


-- 
------------------------------------------------------------------------
Philip M. Gollucci (pgollucci@p6m7g8.com) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

"In all that I've done wrong I know I must have done something right to
deserve a hug every morning and butterfly kisses at night."