in reply to DBI: $dbh-disconnect; yes, now, now, but not now!
Here's one way to do it, if you just want a conditional:
sub make_report1 { my $dbh = shift; my $newdbh=0; if (!defined $dbh) { $dbh = &_get_dbh; $newdbh=1; } ... # close the database connection if opened here $dbh->disconnect() if $newdbh; }
|
|---|