-----Original Message-----
>From: Chas Owens <[EMAIL PROTECTED]>
>Sent: May 9, 2007 11:25 PM
>To: Jeremy Kister <[EMAIL PROTECTED]>
>Cc: beginners@perl.org
>Subject: Re: forking problem with dbd::mysql
>
>On 5/9/07, Chas Owens <[EMAIL PROTECTED]> wrote:
>snip
>> It looks like it has something to do with $dbh going out of scope
>> (when the child exits).
>snip
>
>This is definitely a case of the database handle auto-disconnecting
>when it is destroyed.  You can see the behavior by creating a set of
>DBI subclasses and overriding the DBI::db::destroy function.  Change
>the DBI->connect call to MyDBI->connect and add these lines to the
>bottom of the script.
>


But still has a question for me.We may see this similiar destroy method on DBI 
class,

sub DESTROY 
{
    my $self = shift;
    my $dbh = $self->{'dbh'};
    if ($dbh) {
        local $SIG{'__WARN__'} = sub {};
        $dbh->disconnect();
    }
}

Ok where in child when going out of scope the $dbh should get disconnected.
But why this would affect the $dbh in parent?As we know,when forking child get 
a full copy of $dbh from parent and it's separate to parent's $dbh.

--
mailto:[EMAIL PROTECTED]
http://home.arcor.de/jeffpang/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to