-- Jay Strauss <[EMAIL PROTECTED]>

> Hi,
>
> I'm trying to write a daemon that accesses my database.  I thought I could
> create the connection in the parent, and use it in the child.  But that
> doesn't seem to work.  Below is the code.  Any help would be appreciated

Don't pass DBI objects across forks unless you're into wizardry.  Pass
info instead and have the child proc make its own connections.  Problem
is that when things go out of scope they are DESTROY-ed.  Value goes out
of scope in parent and poof, it's gone.  Leaves child with copy of dead
object.  There are ways around thi sin DBI but they require careful
manglement.  Mucho simpler to just create at least the statemnt handles
in your children -- just make sure that the parent never destroy's the
database handle (e.g., via wait).  dbh's aren't all that expensive so you
can probably just make the connection in the child proc -- also insulates
the child proc's from one another.

sl

Reply via email to