On Saturday 05 June 2004 HH:18:16, Andrew Gaffney wrote:
> I didn't really know where to post this since it isn't specifically Apache
> or Perl, so I'm posting here....just because :)
>
> I run 2 vhosts under Apache 1.3.29 (needed for mod_perl-1.x which is needed
> by HTML::Mason) on my Gentoo server. One vhost is the current production
> site and the other vhost is the development version of the site. I use a
> custom Perl module for authentication and other common functions for all my
> Perl CGI/mod_perl scripts.
>
> I want to be able to make changes to the module, but I only want it to
> affect the second vhost. Basically, I need to have 2 copies of my custom
> module, one for each vhost. Is there an easy way to do this?
Hi Andrew,
that's a very interesting question ;-)
I don't know anything about mod_perl, but I'd think that it depends on how you
load your module and where it is located. IIRC, you can set environment
variables per vhost. Maybe there's a way of modifying the @INC variable for
your development vhost?
Or - a less elegant option: Set an environment variable (or rewrite the URL)
for the development vhost, and replace your authentication module with a
module that checks this environment variable (or: a URL parameter) and loads
the right module.
Let's say your module is called authentication.pm - rename it to
authentication_real.pm and duplicate it as authentication_dev.pm
Create a new file authentication.pm that does something like:
if ($ENV{'development_special_purpose'}) {
require 'authentication_dev.pm';
}
else {
require 'authentication_real.pm';
}
I'm not speaking from experience here and I've not tested or re-checked if
this works, just thinking in loud voice ;-)
HTH,
Philipp
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>