On Fri, Mar 25, 2005 at 11:08:11AM +1100, Andrew Savige wrote:

> Running 'perl test.pl', where test.pl is:
> 
> print "exe_name='$^X'\n";
> 
> produces, on Windows and Linux at least, the absolute path of the
> perl executable, for example:
> 
> exe_name='C:\Perl\bin\perl.exe'
> exe_name='/usr/bin/perl'
> 
> With Pugs however, running:
> 
> print "exe_name='$?EXECUTABLE_NAME'\n";
> 
> produces just the bald:
> 
> exe_name='pugs'
> 
> which is not useful when running pugs programs during make test.
> I worked around this for now, by using "./pugs ..." for Unix and
> "pugs ..." for Windows (where cwd comes first on PATH).
> 
> $^X is defined as "The name used to execute the current copy of Perl".
> In addition to that, there is C's argv[0] (which may or may not match
> $^X) and the file name of the perl/pugs executable (which may or may
> not match $^X). Not that I have a use for the last two, but I don't
> a way to get them from perl.

I know for Linux (and at least FreeBSD and Solaris) there's some code in
perl 5.8.0 and later to attempt to find the absolute path of the perl
executable to populate $^X with. Offhand I don't know about Windows.

This may explain why you're seeing full pathnames for Perl 5, but only
the leafname in pugs - pugs is using whatever the OS passed in as argv[0]

Nicholas Clark

Reply via email to