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

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



> -----Original Message-----
> From: owner-macperl@macperl.org [mailto:owner-macperl@macperl.org]On
> Behalf Of Peter Prymmer
> Sent: Wednesday, May 19, 1999 11:25 PM
> To: macperl@macperl.org; vlb@cfcl.com
> Subject: Re: [MacPerl] the directory where the script is running
>
>
>
> Vicki Brown wrote:
>
> > If you want a _portable_ solution, however... it gets harder.
>
> <snip>
>
> > If the script is called by a relative pathname, then $0 contains that
> > relative path (and you have to figure out the location by where it is in
> > terms of the current directory.)
>
> ??
>
>  use Cwd;
>
>  my $pwd = cwd;
>
>  print "I think I am in $pwd\n";

I agree, this is what I use on my Win32 and UNIX systems.

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!

But that's when I use $0...
   my $scriptPath = $0;
      $scriptPath =~  s!(^.*\\).*!$1!;


Walter


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