Is there any way I can recover the DSN from $dbh?

I have a number of Perl functions that take as an argument a DBI
database handle and read data from the database which can reasonably
be assumed not to change over the lifetime of the process.

For this reason I want to cache this information in Perl variables.

However it is possible that these utility functions may be called with
handles connected to different databases.  For this reason I want to
use the DSN as the top-level key of the cache.

If I can't get the DSN, is there something else I could use?

This doesn't have to be infallible - I'm not worried about user names
or people switching database mid-connection.

Reply via email to