On Thu, 7 Feb 2002 21:36:40 -0800, Michael A Chase wrote:

>> On Thu, 7 Feb 2002 12:14:02 -0800, Michael A Chase wrote:
>>
>> ># You don't need to disconnect, each assignment to $dbh does that for
>you.
>>
>> If only with a warning.
>
>You get a warning if you let the program exit without disconnecting.
>Letting $dbh go out of scope at the end of the loop might avoid the warning,
>but I'm not completely sure.
>
>It is definitely not necessary to call disconnect() every time through the
>loop.

>From the POD:

Warnings

  Database handle destroyed without explicit disconnect

A $dbh handle went out of scope or the program ended before the handle
was disconnected from the database.  You should always explicitly call
disconnect when you are finished using a database handle. If using
transactions then you should also explicitly call commit or rollback
before disconnect.

This quote makes no distinction between ending the program and going out
of scope. To me this indicates that the warning is produced in the
DESTROY action, which gets invoked in both cases.

I can't say I can find it back in the Perl source. Maybe it's in the XS
part.

-- 
        Bart.

Reply via email to