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

Re: [MacPerl] the directory where the script is running



At 6.53 -0400 1999.05.20, Bart Lateur wrote:
>On Thu, 20 May 1999 00:27:40 -0500, Walter wrote:
>
>>The only problem I have found with this MODule is when placed in a CGI
>>running under MS IIS ( web server). It returns the path to the CGI
>>directory, not he script path. grrrr!
>
>If you want to know the path of the script on CGI, look at the
>environmental variables. At least, I find, on Solaris+Apache that
>$ENV{SCRIPT_FILENAME} contains the full path of script.
>
>You should test for yourself if your platform supports this, too.

I believe it is SCRIPT_NAME.  That's what I get in all my web servers.

You can also use something like this, where the executing script is in the
current directory:

#!perl -w
use File::Basename;
use File::Spec::Functions;  # included with perl5.004_05, works with MacPerl
use Cwd;

my $script = catfile(cwd(), basename($0));

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org