[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Omaha.pm] use lib "$ENV{J}/lib";



Jeff Bisbee wrote:
On 12/9/05, Jay Hannah <jhannah@omnihotels.com> wrote:
This is pretty weird, but I got a call from a friend, and yes, indeed,
you can set up @INC via "use lib" using an enfironmental variable...

If you're going to modify an environment variable why not PERL5LIB? (It's how we manage things at work). (use "$ENV{J}/lib" is a cool
trick though) :)

Yes... Using %ENV generally makes me feel dirty. I don't recommend it, but in this case my friend was trying to debug a bunch of vendor supplied code w/ obscure environment variable names and "didn't want to re-write everything".

Another trick I do is to define environment vars to turn on bits of debugging.

  use constant DEV_REQUEST => $ENV{DEV_REQUEST} || 0;
  ...
  warn "new request" if DEV_REQUEST;

Since this is done in mod_perl, if its false, the will be completely
skipped if DEV_REQUEST if false.

We're currently handling this sort of debug switching via Log::Log4perl, which is pretty handy.
Haven't heard from you in a while. I thought maybe Florida swallowed you up? -grin-  (Tangent: Perhaps we should order t-shirts again before the 2 year anniv rolls around and they might chuck our screen?)

j