in reply to Re^3: Perl Oracle Database Connections remain ESTABLISHED!!
in thread Perl Oracle Database Connections remain ESTABLISHED!!

That would cause a scoping problem, but wouldn't prevent an actual disconnect() call from working.
  • Comment on Re^4: Perl Oracle Database Connections remain ESTABLISHED!!

Replies are listed 'Best First'.
Re^5: Perl Oracle Database Connections remain ESTABLISHED!!
by astroboy (Chaplain) on Jan 04, 2006 at 02:27 UTC
    It's may not be just a scoping problem. Apache::Registry will cache the script inside a subroutine, similar to
    #!/usr/local/bin/perl -w use DBI; use strict; use diagnostics; sub emulate_sub { my $dbh; sub connect { $dbh = DBI->connect('dbi:Oracle:rdb1', 'scott', 'tiger') || die DBI::errstr; } }
    I suspect that there's there's a copy with a connection, but the diconnect is not available. UPDATE: I was updating the thread while perrin was replying. It probably won't affect what he says, as his answer still applies to the updated version
      Apache::Registry wraps it in a sub, but since $dbh is visible to both the connect and disconnect subs, it doesn't really matter. The $dbh variable will stay in scope, but the disconnect call will still work unless there is an actual bug in his code. The scoping seems to have been intentional.