On Fri, 24 Aug 2001, Anton Slabbinck wrote:
> I'm having a problem with Global and virtual hosting.
> For each virtual server I have a PerlSetVar Global to a unique directory. In
> each of those directories there exists a General.pm for that site. In the
> page I have a 'use General;'.
>
> The problem is, from time to time, Apache::ASP uses the wrong General.pm
> (from an other virtual server, application).
This is a mod_perl issue, not specific to Apache::ASP. It has to do with
how "use" and "require" work. Let's say you have the following files:
/site1/General.pm
/site2/General.pm
Let's say you have "use General;" in /site1/index.pl and /site2/index.pl.
When /site1/index.pl calls "use General;", "General.pm" gets added to
%INC.
Now when /site2/index.pl calls "use General;" and is run by the same httpd
child process, it will see that "General.pm" is already in %INC, so it
doesn't load it again. It ends up using the General.pm from /site1/ which
is already loaded into memory.
(Hey, has anyone ever tried to replace "use" and "require" with other
functions that push the full pathname onto %INC instead of a relative
pathname? This might fix this sort of bug.)
As for what can you do about this, try putting the following line in your
startup.pl (see
http://perl.apache.org/guide/config.html#A_Script_From_One_Virtual_Host_C
):
$Apache::Registry::NameWithVirtualHost = 1;
If that doesn't help, you might need to do some ugly workaround like:
- renaming General to something else in one of the sites
- running a different instance of Apache for one of the sites
When mod_perl 2.0 comes around, this should no longer be an issue because
it will be able to use different instances of the mod_perl interpreter for
different virtual hosts.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]