in reply to Setting up Class::DBI classes with existing $dbh
You might want to look through the Class::DBI and Ima::DBI documentation, specifically the section called "Dynamic Database Connections" in Class::DBI. You can define your own db_Main() method that returns your DBI connection rather than using set_db() directly. I've never done this, but this should work without a hitch. That is,
package MyClass; use base 'Class::DBI'; # Stuff.... sub connect { # .... } sub db_Main() { return connect; }
|
|---|