perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Initializing Sleepycat::DbXml (Berkeley, Oracle) objects in
Date Wed, 14 Jan 2009 17:39:39 GMT
This is my first time replying to the list.  I've seen
advice about not being able to share a filehandle opened
in a pre-fork stage before, but have two counter-examples:

1) I opened a log file for write/append in the open-logs
stage of a module, and was able to (flock and) write to it
in child processes.  (It's called the open-logs stage!)

2) My web site ties its read-only DBs at the post-config
stage and reads them in the child httpd's.

My one RW DB (for guestbook filtering) has an accompanying
lockfile that's opened and flocked before the DB is tied,
on the fly.

I have a vague recollection of reading about the
circumstances in which filehandles can be inherited, but
can't remember where.  Programming Perl?

Sorry to make things more complex, but I'll be happy if
someone can clarify this.


On Jan 14, 2009, at 8:18 AM, Mark Hedges wrote:
> On Wed, 14 Jan 2009, Michael Ludwig wrote:
>> I want to build a mod_perl2 application using
>> Sleepycat::DbXml. This is
>> However, I don't know how to do this. Currently, I'm
>> trying to set up things in (loaded via
>> PerlPostConfigRequire), store the database environment
>> handle in a global package variable, and access that from
>> the PerlContentHandler.
> This probably won't work since the filehandle cannot be
> shared among mod_perl children.
> Your script is running before the root apache
> process forks into the child processes.  Scalars, lists and
> hashes will be cloned, but file handles won't, they have to
> be opened.
> Probably what you're thinking of is a PerlChildInitHandler
> so that each mod_perl child process does your connection for
> you when the child process first forks.

View raw message