in reply to Re^3: How to share DBI connections between objects?
in thread How to share DBI connections between objects?
I'm not sure I understand. I presume you're objecting to My->Db, right?
Kinda. I'm objecting to their being one hard coded $dbh that everything uses. This makes it harder to, for example, swap in a test database, or maybe decide to split a system over multiple databases.
This isn't really just an issue of database handles, but all "shared" configuration information.
Instead I pass configuration objects in at object construction time, or use factories like Rose::DB to allow me to switch things around more easily.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: How to share DBI connections between objects?
by f00li5h (Chaplain) on Mar 28, 2007 at 00:21 UTC |