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

Alan alan at ufies.org
Tue Apr 3 03:14:12 BST 2007

On Mon, Apr 02, 2007 at 08:31:21PM -0400, Edward J. Sabol wrote:
> Alan <alan at ufies.org> wrote:
> > The mason install is separated but the two CMS::DBI libraries (one
> > running under each vhost) seem to be clashing.
> So the two CMS::DBI libraries mainly differ just in the connection() setup?

That is correct, the only difference ATM is in the set_db() function,
though as the codebase changes for each install it's possible that other
stuff will change as well.

> You say you have separate Mason roots, but are you sure you're running
> separate mod_perl servers? I would think you would need a single lightweight

No, at this point it's just apache2 with mod_perl running with a standard 
virtualhost setup.  I'm running this on a godaddy server, with their
control panel controlling things, so I'm doing as much as possible with
.htaccess files for the actual mason setup as their control panel
rewrites the httpd.conf include files whenever a new domain is added.
I'd like to try to play as nicely as possible with the other tools

> frontend vhost server that proxies to two separate Mason/mod_perl
> heavyweight servers. Also, is there any chance the @INC could be getting
> mixed up between the installations?

If I print out a dump of @INC with my displaypage component it shows
/home/user/site1 within site1, and when it flipflops to the other
database the INC stays the same.

> The next thing I would try is disabling the object index. Put
> $Class::DBI::Weaken_Is_Available = 0;

I didn't have a startup.pl running, but I defined one with
PerlPostConfigRequire /etc/httpd/conf/startup.pl
and then just threw a use for Data::Dumper and Class::DBI, then put in
the weaken_is_avialable line above, no change :(

> in your startup.pl file. If that solves the problem, then you have a scoping
> problem somewhere in your Mason code....

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

Maybe a better question is to ask is it possible to run separate
virtualhosts with separate perl libraries that are named the same, but
have different functionality on the same server.

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 really hope there's a different way to do it though.


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