At 22:24 -0400 3/9/09, Chris Devers wrote, and I snipped.:
This isn't necessarily a Mac-specific question, but I've gotten rusty
and I'm having a brain fart here.

How can a Perl script reliably, portably resolve the path inside which
it is running? Not the PWD of the caller, mind you, but the actual
current full path of the script itself?

$0 That's a zero. Has always worked for me to produce a full path to a running perl script.

$ENV{PWD} is, as you say the working directory when perl, or the script as an executable with a shebang line

There is a module "cwd" I think which will keep $ENV{PWD} correct as you change directories around within a script..

As for portability to other than *NIX, I donno.

--

--> From the U S of A, the only socialist country that refuses to admit it. <--

Reply via email to