On Apr-14, Jeff Clites wrote:
> For Unix platforms at least, you should be able to do this:
> 
>       executablePath = isAbsolute($0) ? dirname($0) : cwd().dirname($0)

Nope.

  sub executablePath {
    return dirname($0) if isAbsolute($0);
    return cwd().dirname($0) if hasSlash($0);
    foreach dir in $PATH {
      return $dir if -x "$dir/$0";
    }
    return "bastard process";
  }

which is why on Linux I give up on portability and say:

  return readlink("/proc/self/exe");

(ok, to match that'd need to be dirname(readlink(...)))

Reply via email to