On Wed, 12 Sep 2012 10:18:49 -0400, Mark Haney wrote:

> I've got what I hope is an easy question to answer.  I've got a perl web
> app that I've setup with a 'live' version (more like a beta actually)
> and a dev version for me to make changes to that might break the other
> site.
> 
> The way I inherited it was as a single site using 'use lib' with the
> library files to a working site being used as the dev version.  I've
> moved the files around to match the first paragraph setup.  Two
> different sets of files, one live the other development.
> 
> For the time being I've manually change the 'use lib' statement before
> uploading the changed/fixed code to the live site, but this is getting a
> bit silly, not to mention completely not standard practice.
> 
> My question is, what IS standard practice for this?  Honestly, I've
> never built a web app in this manner despite writing a lot of perl code.
>   So?  What should I do?  Any suggestions are appreciated.

If the dev site and live site are on different filesystems and each 
doesn't share the other's path, then just put both directories in the use 
lib argument.  That's a bit fragile, though, because one day they might 
both exist on the same system.

What I do is have a module that figures out whether I'm in dev or prod; I 
use it before the use lib and get a value back that I can use to switch 
which path to fetch.  Something like (pseudo code, untested):

use MyEnv;  # Sets $MyEnv::Env_Type
BEGIN {
  require lib;
  lib->import( $MyEnv::Env eq 'dev' ? '/path/to/dev' : '/path/to/prod' );
}

-- 
Peter Scott
http://www.perlmedic.com/     http://www.perldebugged.com/
http://www.informit.com/store/product.aspx?isbn=0137001274
http://www.oreillyschool.com/certificates/perl-programming.php

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to