"Nicholas Clark" <[EMAIL PROTECTED]> wrote:
On Wed, Jan 19, 2005 at 10:54:53AM -0500, Dan Sugalski wrote:

"parrot". If, on the other hand, we were invoked as:

     parrot foo.pbc

then both fullname and basename would be "parrot". Unix hashbang (and
Windows file association) invocation may give us something different
-- if the user did:

   ~/src/foo.pasm

and you'd either associated .pasm with parrot, or foo.pasm started
"#! /usr/bin/parrot" (which is legal :) then you'd get a fullname of
"~/src/foo.pasm" and a basename of "foo".

Clear and sensible?

Perl 5 makes the distinction between $^X (the interpreter name) and $0 (the script name)

Perl 5 also puts some effort into seeing if it can get a fully qualified
path for the interpreter from the OS. Certainly this is do-able on Solaris,
on Linux given /proc, and on FreeBSD given /proc and a following wind
(at least on FreeBSD 4 where there is a bug). I think it's do-able on Win32
too.


Yeah, on Win32 it's do-able by using the GetModuleFileName API and passing NULL in as the first parameter. That gives the full path and name of the current executable.

Jonathan



Reply via email to