On May 9, 2007, at 5:41 PM, Jeff Pang wrote:
-----Original Message-----
From: Chas Owens <[EMAIL PROTECTED]>
The solution:
Setting a flag (InactiveDestroy) on the parent's handle inside the
child process prevents the automagic closing of the connection.
* the magic in this case is the DESTROY method of DBI::db
Using InactiveDestroy flag seems a standard way since this module's
author provide this flag.
But it's maybe bring some problems when the applications are large
enough,and it's not the fact that every programmer would disconnect
their dbh connections in time.For example,consider the case
programs were run under modperl and without Apache::DBI,using this
flag would possibly make lots of db connections to database and
consume db's socket source quickly.
Then for me I would maybe consider another way of creating its own
dbh in child after fork.
Hope I'm right,:)
From perldoc:
This attribute is specifically designed for use in Unix applica-
tions that "fork" child processes. Either the parent or
the child
process, but not both, should set "InactiveDestroy" on
all their
shared handles. Note that some databases, including
Oracle, don't
support passing a database connection across a fork.
In short -- you are lucky it can be supported.
But in order to keep things portable, this might be something to avoid?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/