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

"Edward J. Sabol" <sabol-2oVx0MVsMgiP/[email protected]> Mon, 2 Apr 2007 22:50:37 -0400
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <[email protected]>
Alan <[email protected]> wrote:
> I'm sure that this has something to do with mod_perl and the naming of
> the libraries being the same and then running in the same memory space
> in the httpd processes, but I really hope there's a way to separate
> them.

Yes, I concur with that assessment.

> 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.

> I really hope there's a different way to do it though.

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.

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.

Hope this helps,
Ed