On Tue, 18 Jan 2000, Doug MacEachern wrote:

> On Wed, 19 Jan 2000, Stas Bekman wrote:
> > 
> > Why? Some users need a control of what gets reloaded and what not on
> > server start (Yes I know if you put in startup.pl file it loads only once) 
> > For example parsing and loading some heavy xml files...
> > 
> > Why do you want to take it away?
> 
> I think PerlRestartHandler is a better solution in most cases.  and inside
> <Perl> sections you can always do it on your own:
> 
> <Perl>
> do_something() unless $My::Init++
> </Perl>

Sure

> I'm cringing at global variables in general looking forwared to threaded
> 2.0.  do you have a concrete example that requires
> $Apache::Server::{Starting,ReStarting} ?

You can get away with internal tracking like you did above with $My::Init,
but IMHO it's not a clean approach. How about adding a new method that
will return the server status. No global variables needed.

do {} if Apache::server_status() == Apache::Constant::Starting;

So you can add other modes like,
Starting|Restarting|Running|HavingLunch|Stopping|Dyeing.

The examples are:
* Start/Restart - when some heavy startup operation should be performed
(e.g. a heavy XML parsing and preloading like someone posted awhile ago)

* Stopping - I wrote this runaway watchdog and had to make it a standalone
program which has no idea whether the server is running. I wanted the code
to be aware of the server status and spawn from the startup file, and kill
it when the server is stopping... I guess I can provide more cleanup
scenarios too. 


_______________________________________________________________________
Stas Bekman    mailto:[EMAIL PROTECTED]      http://www.stason.org/stas
Perl,CGI,Apache,Linux,Web,Java,PC     http://www.stason.org/stas/TULARC
perl.apache.org    modperl.sourcegarden.org   perlmonth.com    perl.org
single o-> + single o-+ = singlesheaven    http://www.singlesheaven.com

Reply via email to