perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philippe M. Chiasson" <>
Subject Re: [mp1 bug] mp_preload_module() bustage
Date Thu, 12 Jun 2003 14:11:57 GMT
On Wed, 2003-06-11 at 20:14, Geoffrey Young wrote:
> >     if(!perl_module_is_loaded(*name)) { 
> > PerlLogHandler My::Module->somehandler
> > or
> > PerlLogHandler $My::Obj->somehandler
> > 
> > First of them is that My::Module->somehandler gets called on startup (or
> > once per request if in a .htaccess) without a valid $r as argument.
> > 
> > Second one, the require call itself will most likely fail, trying to
> > require the value of Apache::OK.
> > 
> > I propose to fix mp_preload_module to be a bit smarter and skip those
> > odd cases... 
> > 
> > But I wonder how come this issue hasn't been reported already? Am I
> > missing something terribly simple here?
> I suspect the reason it hasn't been reported is because it tends to fix 
> itself :)  method handlers (in mp1 at least) require the module to be 
> preloaded - otherwise mod_perl doesn't resolve the ($class, $r) stuff 
> properly and it doesn't work anyway.

Well, this does make sense, since if you do
PerlHandler This::Handler->foo, mp_preload_module will try to require
This::Handler->foo and of course, that won't load This::Handler, thus
the run-time problem.

> so, I suspect that most people figure it out when the module doesn't work as 
> expected, preload the module, and don't see a problem.

Well, preloading will sure fix the breakage, but you will still get one
strange _extra_ call to that method with no $r on startup.

> does that seem to gel with what you've found?

Sure does! I figured if I looked back in the mlist archives I might find
something like this. Thanks for the insight then Geoff !

It also means that mp_preload_module is indeed broken and will be fixed
shortly ;-) Unless anybody beats me to it, that is.

> --Geoff
-- -----------------------------------------------------------------------------
Philippe M. Chiasson /gozer\@(cpan|ectoplasm)\.org/ 88C3A5A5 (122FF51B/C634E37B)    F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3 A5A5
Q: It is impossible to make anything foolproof because fools are so ingenious.
perl -e'$$=\${gozer};{$_=unpack(P7,pack(L,$$));/^JAm_pH\n$/&&print||$$++&&redo}'

View raw message