On Wed, 25 Apr 2001, Philippe M . Chiasson wrote:

> A suggested new feature.
>
> Apache->dso_module('mod_example.c') behaves like
> Apache->module('mod_example.c') except it returns 1 if the
> module is loaded as DSO, 0 if it's compiled in and undef
> if it's not present at all.
>
> I wrote this because of a few problems I had with the 'slight'
> differences in behaviour of mod_perl under DSO and compiled in.
>
> In my case, I call an init function from a startup.pl, and because
> of the way apache starts then restarts, it gets called twice if mod_perl
> is compiled in and only once if it's a DSO.
>
> So I end up with code like this:
>
> sub init {
>       return if($Apache::Server::Starting && not $Global::MOD_PERL_AS_DSO);
>       }
>

Back to the old problem... Eric Cholet has implemented
$Apache::Server::Restarting, but for various reasons it's never went in.

Currently I think there is a slight "bug" in the latest mod_perl 1.x,
where PerlRequire doesn't work as require() in Perl per se on restart. A
few people have reported this behavior.

So as a quick workaround do this:

start.pl:
---------
require "real-startup.pl";

this require(), won't be called twice.

> I guess it could be usefull for other purposes to, so here is the patch.

I'm not underestimating the power of your patch of course :) I think the
real fix should be in PerlRequire.

BTW, the same problem happens to PerlModule. I've moved all my preloadings
into the Perl domain, mod_perl reloads them twice.

_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://logilune.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


Reply via email to