G.W. Haywood wrote:
> 
> On Wed, 18 Oct 2000, Ernest Lergon wrote:
> 
> > 1) Our apache is running 20 childs. A perl module is loaded via
> > startup.pl. On shutdown of apache the END block of this module is called
> > 20 times and not only 1 time as I expected. Why?
> 
> Because each child is its own program and each executes the block.
> You could put a global flag in there if you're adamant that it mustn't
> do things more than once.
> 
This workaround came to my mind too, but how does it fit in the idea of
shared modules in mod_perl?

>
> > 2) I want to use the END block of this preloaded module to execute some
> > cleanup - checking and writing back to disk data possibly changed during
> > module livetime: a lengthy operation.
> 
> You shouldn't need to do tha, the OS should take care of it if you
> just close the files.  Use Symbol;
> 
So I have to go more in detail: It's not just closing files. On startup
of apache (and loading of the module) the files will be read in and the
module creates an internal net of objects (sort of cache). The files
will be locked on disk so that a call to the module via unwanted mod_cgi
will fail. Those objects might be changed by several requests to this
module. On shutdown (NOT after each request!) all objects are checked
and changed objects are written back to the files on disk.

I expected, that this will be done once in the END block and that apache
will wait.

The root of the net of objects is a Class::Singleton object.

Ernest

Reply via email to