perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Perrin Harkins" <per...@elem.com>
Subject Re: share objects
Date Thu, 03 Apr 2008 16:24:19 GMT
On Thu, Apr 3, 2008 at 11:32 AM, Felipe de Jesús Molina Bravo
<fjmolinabravo@gmail.com> wrote:
> I know I can share data between processes, but what I also shared objects?

It depends on what you mean by share.  You can create a simple perl
object in startup.pl and access it from all processes later, but if
you change it in one process, the change will not be seen in the
others.  With objects that contain open sockets, file handles, or XS
structures, you usually can't share them at all.  This is why you
can't open a DBI connection in startup and use it from your child
processes.

I don't know Sleepycat::DBXML, but it sounds like something that would
use file handles.  Try creating your object in a PerlInitHandler
instead, which runs in the child process when it is first created.

- Perrin

Mime
View raw message