Hi Daniel, I hope this helps, I've had to make some assumptions, so please feel free to correct me..
Firstly, the bad news. > Is there no way to turn that 'off' ? No:-) (none that I know of that are actually worth it) I think you have a fundamental problem that cannot be solved without some re-engineering on your part. I think you would find it really beneficial to spend a little time looking at how mod_perl works. In that it has a preforking mechanism and a copy on write memory system. (http://perl.apache.org/docs/1.0/guide/performance.html - not sure what the MP2 link is..) The issue I think you are having is that you aren't declaring your use db; in a startup.pl. Now I suspect this is because until a user makes a page request (for a given site) you don't know which db.pm they need to access. Bear with me (I think I'm going in the right direction) So IF (and I am assuming a few things here, so correct me if I'm wrong) you aren't preloading db.pm at startup then if you remove the 'use db;' line, your epl will die at runtime saying can't load method blahblah on module db.pm at line xxx...). BUT because you DO have a use db.pm in your epl Embperl and thus Mod perl tries to be clever and tries to guess what you want to do, and tries to load that module at runtime. First it checks if it's already loaded db.pm and if not it goes and loads it. If it had already loaded it, then it'd give you what it already has. Apache, uses forked children to handle each page request. These children can serve ANY virtual host on your server. so the first request a child handles is from site X and the second site y. What is happenning in your case is that the first request is for site x and so x's db.pm gets loaded, then the second request is for site y... However x'db.pm fools mod_perl that db.pm is already loaded.... So what can you do? Well, firstly I think your original intention sounds kinda right, but the implementation wasn't ready for the Namepsace clash you're having... Fixing the namespace would work use X::db; use Y::db; my $db_inst; if ($req_req->server_hostname eq 'SiteX.com') #or however you are identifying your sites { $db_inst=X::db->new(); } else { $db_inst=Y::db->new(); } Without knowing more about your system it's difficult to try to work anything else out. Feel free to send me more info and I'll try to help, Marty --- Daniel <[EMAIL PROTECTED]> wrote: > On Mon, Feb 27, 2006 at 05:24:55PM +0100, RobertCZ > wrote: > > not very clear what exactly you are doing - you > have two apache virtual > > servers both using Embperl::Object and they clash? > you use > > Embperl_App_Name, right? > > hm, no, not quite. > > > > if I dont understand, would you mind showing us > some simplified code? > > let me try. > > index.epl has a use statement. > use db; > > That loads a Class::DBI database abstraction class. > > I have two instances of my application running. > > they live in two different paths, but the db module > exists in both. > > the db module get's loaded with certain configs, > which live in > config.pm which is done with a require. > > my $cfg = require config.pm or some such. > > I have a function for the database abstraction class > called getConfig. > > For my two instances, if I do something like this... > > print OUT $db_inst->getConfig->{'mysql'}{'dbname'} > > from indexer.epl, and I keep reloading, sometimes I > will get the dbname > appropriate for the first instance of my > application, and sometimes for > the second. > > My applications both share the same framework, but > are supposed to run > as completely seperate instances. > > I think apache objects witht he same filenames get > passed around, > regadless if the content is different. > > Let me give an example of another scenario where > I've seen it happen. > > I've got one version of db.pm loaded for one app, > then I have another > db.pm loaded for another app. Apache shares the > loaded libraries between > it's instances, and one version of db.pm may have a > function called > PrintRows, while the other doesn't. Randomly the > correct one will get > loaded, randomly not. > > has noone bumped into this? I think apache for > speeds sake is trying to > load the classes and keep them in memory. > > Is there no way to turn that 'off' ? > > I hope this is more clear. > > -d > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > ___________________________________________________________ Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]