http://qs321.pair.com?node_id=1002372


in reply to Re: use lib in cgi env
in thread use lib in cgi env

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.