Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: use lib in cgi env

by space_monk (Chaplain)
on Nov 05, 2012 at 16:37 UTC ( #1002356=note: print w/replies, xml ) Need Help??

in reply to use lib in cgi env

Embedding a fixed path in the code is not a good plan. Why not try alternative methods of setting a path for libraries, such as setting the PERL5LIB environment variable, or starting perl with the include path on the command line?

Replies are listed 'Best First'.
Re^2: use lib in cgi env
by sundialsvc4 (Abbot) on Nov 05, 2012 at 17:37 UTC

    The problem here is how (and whether) that environment-variable will be set when the CGI/FastCGI script executes.   The web-server e.g. Apache sets up a more limited environment so that the runtime behavior of the script is more certain and less subject to undue influence.

    In the specific case of a CGI script destined for a known implementation target, I find that setting fixed paths is a reasonable and perhaps desirable technique.   You know what the right answers are and always will be.   And, as noted above, I isolate it into one root script which is known to have global influence upon the rest of it.   Your Mileage May Vary™, but in the specific case I described above, what I chose to do was a most-deliberate choice that did fully consider what you suggest.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1002356]
[choroba]: or nobody bothered...
[choroba]: The problem was bigger, as the test tried to call a method that didn't exist anymore
[marinersk]: :: ducking ::
[choroba]: because, someone renamed the method, but didn't notice it was used in the test, as the test was skipped
[marinersk]: Well, if the method doesn't exist, it would be hard to pass the test.
[choroba]: later, someone removed the new method, as all its usage places were safe, but didn't notice the test still used the old name
[choroba]: fortunately, it wasn't that hard to replace the method and fix a few remaining failures due to the changes we did to the codebase over the years
[marinersk]: choroba Sounds like a process improvement opportunity; tests may not all need to be run, but they should all be compiled with perl -c before check-in/promotion happens.
[choroba]: so, now I have the test, so I can start making changes in the code. Back to the original ticket, yay!
[marinersk]: I definitely love it when my $current_taask=& taskPop(); if ($current_task eq $original_task) { } is true.

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (15)
As of 2017-05-25 15:12 GMT
Find Nodes?
    Voting Booth?