[CDBI] odd swapping database issue on vhost / mason install
Alan <[email protected]> Mon, 2 Apr 2007 16:46:01 -0700
| Newsgroups | gmane.comp.lang.perl.modules.class-dbi |
|---|---|
| Message-ID | <[email protected]> |
Hey all. I have a bit of an odd situation with class::dbi on an HTML::Mason install that is starting to be a bit of an issue. The situation is that I have two virtual hosts on a dedicated server, both running close to the same codebase, using Mason which utilizes class::dbi for all my database access. The idea is I have a content management system written in mason that will be customized slightly per-user, and it'll all run on the same host. The mason install is separated but the two CMS::DBI libraries (one running under each vhost) seem to be clashing. The issue is that the database handle seems to swap between sites randomly. My system prints out pages (site.com/test.html) by getting them dynamically from the dabase, and randomly I'll get a page not found, then reload and it's there, then reload and it's gone. The site is using Class::DBI and both virtualhosts are using a library with the same name (CMS::DBI), not sure if the naming is the issue, it appears so, but I'm not sure how to fix it. I write a little chunk of code in my displaypage.mc component that gets the $dbh handle via class::dbi->db_Main and then does a query against it to show all the databases. Ocassionally, sometimes once a reload sometimes once every couple of reloads, the dump at the top goes from database name of 'site1' to a name of 'site2'. Is there a way to separate the namespace of a mason install? Maybe with a custom handler or something? Right now I'm just using the default 'SetHandler perl-script / PerlHandler HTML::Mason::ApacheHandler' and would really like to not have to change my code from CMS::DBI to CMS2::DBI each time I add a new vhost. Any mason/class-dbi experts input appreciated. TIA Alan (also posted to the mason list in case it's mason issue) -- Alan <[email protected]> - http://arcterex.net -------------------------------------------------------------------- "Backups are for people who don't pray." -- big Mike