i don't know of any way to figure out programmatically
through DBI whether or not any connections have been made.
the only way i can think of is a policy oriented way such
as you've suggested (standardizing on $dbh and $sth for
handler names).
i checked out the source of DBD::Pg, and from the looks
of things, connect() doesn't keep track of connections.
perhaps DBD::MySql does, i don't know.