On Thu, Apr 07, 2011 at 10:21:49AM -0700, Quinn Weaver wrote: > Hi, > > I'm working on a new feature for David E. Wheeler's DBIx::Connector module. I > want to make it so that if you pass an an existing dbh to the constructor, > you get back a DBIx::Connector object that wraps the dbh. (DBIx::Connector > adds transaction, savepoint, and reconnect logic to DBI). > > The problem is, in order to add this feature, I need the original args that > were passed to connect() when creating the dbh. The reason is that > DBIx::Connector will need to construct the dbh anew if it gets disconnected. > > However, I can't find a way to get those args out of the dbh. Normally I > would try looping over the contents of the tied hash, but FIRSTKEY and > NEXTKEY both have null method bodies (i.e. { }), so looping is effectively > disabled. > > Any ideas? Tim, would you be amenable to a patch that implemented FIRSTKEY > and NEXTKEY? It seems to me that there are legitimate use cases for > introspection, such as this one.
Take a look at the $dbh->clone method. Tim.