John Heitmann wrote:

> Hello,
> 
> I have a problem, and I have a poor solution; I would like to see if I 
> can do even better. My problem is that I have a set of scripts and 
> modules that are duplicated on the same Apache server setup. One tree is 
> for debugging and developing, the other is the main release site. These 
> are managed through cvs. The issue I ran into was that the debug scripts 
> would request debug modules, but get the same-named release module if it 
> was already loaded in the same Apache process (and vice versa).
> 
> Here what my old (buggy under mod_perl) include stuff was like:
> 
> use lib "../lib";
> use MyModule;
> 
> Here is what I had to do to force correct module loading (mostly stolen 
> from the great mod_perl guide):
> 
> %INC = (); # Possibly unnecessary
> do 'FindBin.pm';
> unshift @INC, "$FindBin::Bin"; # There are also modules in the same dir 
> as the script
> unshift @INC, "$FindBin::Bin/../lib/";
> 
> require MyModule;
> import MyModule;
> 
> 
> So I'm loosing all of that slick compile-time speed savings and clean 
> code just so I can have two source trees on the same server. One obvious 
> answer is to move the devel tree off of the same server as the release 
> tree. I will eventually do that, but it would be cool to see a solution 
> that works with my current setup. Is there maybe a way to do tricks to 
> modules like Apache::Registry does to scripts by automagically 
> prepending the directory name behind the scenes? Any other ideas or 
> places to RTFM?
> 
> Thanks,

Some solutions are here, but they aren't good for production
http://perl.apache.org/guide/config.html#Is_There_a_Way_to_Modify_INC_on

I think the best solution is to run your staging server on a different 
port and use a front-end proxy to rewrite to the right server based on 
the Host: name. Alternatively put 2 NICs with 2 IPs, that will work if 
you don't hardcode the server name in your code/html.

BTW, mod_perl 2.0 solves this problem.

_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/

Reply via email to