in reply to Querying a $dbh

Waaaaaaay down at the end of the DBI perldoc it has a section "Database Handle Attributes" that shows the "published" attributes that are available for pulling out of the $dbh hashref. The first two items in your list are obtainable through the Name and Username keys (and there's a Driver that you can use to retrieve the database driver name the handle is using).

Update: Just to clarify I mean "published" in the sense of "it's explicitly documenting that the hashref for the handle will have those keys and it's implicitly OKing breaking encapsulation to retrieve them".

The cake is a lie.
The cake is a lie.
The cake is a lie.

Replies are listed 'Best First'.
Re^2: Querying a $dbh
by ysth (Canon) on May 02, 2008 at 03:43 UTC
    DBI handles are actually refs to tied hashes, so using the documented hash elements isn't breaking encapsulation in any sense; anything you do to the hashref is very much a part of the API.