[CDBI] Re: odd swapping database issue on vhost / mason install

Alan alan at ufies.org
Tue Apr 3 04:13:32 BST 2007

> > I'm going to try a (ugh) search/replace for the library name, rename it
> > from CMS::DBI to Client1::DBI and see if that fixes it (I'm sure it
> > will).
> I suspect it will as well.

It seemed to, but there was still some oddness (my dhandler didn't
output my @INC dump on each page load for example).  Still, better...

> Well, as I mentioned in my previous e-mail, I would run two separate mod_perl
> servers, but I gather that's not an option for you.

Technically possible, however I'd like to avoid more complicated setups
if possible.

> Instead of fighting to keep the CMS::DBI modules separate, you could instead
> merge them and make them identical. In other words, have one CMS::DBI module
> that returns the appropriate dbh for each vhost by overriding db_Main(). Take
> a look at
> http://wiki.class-dbi.com/wiki/Using_with_mod_perl
> You *definitely* need to disable the object index in this scenario, otherwise
> the index could become cross-contaminated.

Will definately look into that.

Another option I thought of was go combine the databases into one, and
separate data with a table prefix.  

So CMS::DBI packages are still separate, but they both connect to the
same database, then they define their tables differently.  IE:

# site 1
package CMS::Page;
use base 'CMS::DBI';

# site 2
package CMS::Page;
use base 'CMS::DBI';

A bit more work in the setup phase, but easier copying of code across
(to create site 3 I just cp -a /home/user/site1 /home/user/site3, then
search/replace in the /home/user/site3/lib/CMS/DBI.pm and the

Or do you think this would still cause issues?  I suppose if both are
still called CMS::DBI then they'd possibly be accessing different the
wrong ones.  Bah.  I'll give it quick try now though, and see what


Alan <alan at ufies.org> - http://arcterex.net
"Backups are for people who don't pray."                 -- big Mike

More information about the ClassDBI mailing list