perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew O'Brien" <Andrew.O'Br...@oriel.com.au>
Subject RE: Apache virtulahosts sharing modules
Date Tue, 20 Jul 2004 07:45:24 GMT

> From: Steve Wilder [mailto:stevew@m8rix.net] 
> Subject: Apache virtulahosts sharing modules
> 
> 
>   Hello, all.
> 
>   I'm using Apache 1.3.29 and  Embperl 1.3.6
> 
> I've got two Apache Virtualhosts: www.benwilder, and 
> rhyme.benwilder.com
> 
> Both sites have a "test1.phtml" which looks like this:
> ----------------------------
> [! use test1; !]
> 
> [+ test1::whereami() +]<br>
> ----------------------------
> 
> Both sites have a test1.pm file which sits in their Document Root

This causes issues within mod_perl. Mod_perl caches things based on
namespace, just like perl, so eventually you get the case where the
module is not reloaded and you have sync issues.

> The problem is that if I reload one or the other enough 
> times, it will 
> begin using the other sites test1.pm!  I need each site to 
> only use it's 
> own test1.pm.
> 
> If I restart Apache, the problem goes away for a time, but will come 
> back if I reload one or the other enough times.
> 
> BTW: In my httpd.conf, I set "PerlSetEnv PERL5LIB" in the VirtualHost 
> directive to its own Document Root.
> 
> How do I lock each VirtualHost to it's own test1.pm module?

I have never found a really nice way to get around this issue - perhaps
others have. Occasionally I have resorted to Apache::PerlVINC
(http://search.cpan.org/dist/Apache-PerlVINC/) but this removes all the
caching speedups you get with mod_perl by unloading the modules at the
end of every request. Even then I've found cases where non-cleaned-up
references cause unloads to fail and you end up with sync issues again.

Your best bet is to have site-specific information set up at the embperl
request level. Ie have constants/whatever initialised in base files
rather than having that kind of logic in the modules.

Anyone have other ideas?

Cheers,

Andrew

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message