httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Hartill <>
Subject Re: cwdir a part of CGI spec?
Date Fri, 26 May 1995 09:26:43 GMT

Brian B. wrote,

> require "./"
> in script.cgi.  With NetSite (and I'm sorry to single it out, Rob, I'm 
> sure others have this problem) I'd have to explicitly state
> require "/path/scripts/"
> which suddenly make my scripts a lot less portable.  

You can make your scripts more portable e.g.  with

unshift(@INC, $1) if __FILE__ =~ m#(.+)/#;

This looks for a path in the script name, and if it finds one, it adds 
it to the default "INClude" path which "require" uses.

I do this as standard practise for many of my perl scripts so that I 
can run them from the command line from anywhere.

Rob Hartill                  

View raw message