in reply to Problem creating a singleton wrapper around DBI
Your immediate problem is that DBI::connect() returns a DBI::db object, not a DBI object, so your subclass does not inherit from the right class.
You don't need inheritance for this to work though. Take out all of the @ISA code and change the last few lines of new() to:
# Connect return DBI->connect( $datasource, $dbuser, $dbpass );
If you do that, the caching will still work as long as all of your code calls the instance() method. (If it were my code, I would rename new() to connect() or something similar to make it more clear that this is a singleton factory.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Problem creating a singleton wrapper around DBI
by brian_d_foy (Abbot) on Aug 23, 2005 at 03:56 UTC | |
by skx (Parson) on Aug 23, 2005 at 04:23 UTC |