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?
From what I've heard over at PerlMonks, this won't work because of the way that mod_perl-1.x works.
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 ;-)
I'm looking for something that doesn't require extra code, but it would probably work.
-- Andrew Gaffney Network Administrator Skyline Aeronautics, LLC. 636-357-1548
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>