On 5/9/07, Jeff Pang <[EMAIL PROTECTED]> wrote: snip
Yes but I think is this maybe a bug in DBI class?For example,open a file handle and after forking child close that handle,this would not affect parent's handle.
snip
It definitely violates the principle of least surprise, but it is also a very hard problem. File handles are much simpler* in comparison. The handle is auto-disconnecting so that you don't accidentally exit your script leaving the database connection open. Imagine a script that connects to the database, runs a short query, and then ends. Now imagine that script running several times a second. Each time it runs it leaks a connection that is not reclaimed by the server until it times out (if it times out). The proper way to handle this (in my opinion, which might be terribly flawed since I haven't thought about it very hard yet) is to have some sort of flag that can be set on the database handle to tell the DBI to destroy it without closing the connection. This flag could be set in the child and everybody would be happy. I am looking in the docs now to see if such a flag exists. If it doesn't then I am going to bug the maintainers of both the DBI and DBD::mysql to add it. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/