# New Ticket Created by  Will Coleda 
# Please include the string:  [perl #33923]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=33923 >


Dan says:

Let's add it as a TODO. Two new interpinfo options -- fullname (which gives the 
entire executable name as we got it) and basename which gives the name without 
the path and suffix information.

As an example, if we were invoked as:

    ~/src/parrot/parrot foo.pbc

then fullname would be "~/src/parrot/parrot" and basename would be "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? 

------------------

Nicholas says:
> 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.
>
> Would we want to try to do this?

Followed up by dan:

Good point--we should. That'd mean we'd want to have three sets of data: the 
invoked full/base name, the 'program' full/base name, and the interpreter 
full/base name. (With the invoked full/base being the same as either the 
program or interpreter full/base, but which way it went would depend on how 
things were fired off, so we might as well have them all separate) 

Jonathan Worthington adds:

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. 

Reply via email to