Re: Finding "this file name".

Howard Charles wrote:
> This is very strange.
> The following works just fine:
> #!/usr/local/bin/perl -w -l
> use FindBin;
> print 'This path name: '.Win32::GetLongPathName($FindBin::Bin);
> print 'This file name: '.Win32::GetLongPathName($FindBin::Script);
> __END__
> ...but when I execute the same two statements as two separate DOS
> commands in a .bat file (Windows ME) as follows:
> perl -MFindBin -le "print 'This path name:
> '.Win32::GetLongPathName($FindBin::Bin)"
> perl -MFindBin -le "print 'This file name:
> '.Win32::GetLongPathName($FindBin::Script)"
> ...the first DOS command works, but the second one doesn't! The second
> one prints a null string for the
> "Win32::GetLongPathName($FindBin::Script)"!

I'm confused as to what you were expecting to happen. That code is in
a one-liner. There is no script, and therefore no script name. In this
case, Perl will report the script name as "-e", since the code is
coming from a -e command line switch. Passing that to GetLongPathName
results in an empty string, as Windows has know knowledge of any path
named "-e".

What value were you hoping for this code to produce?

Paul Lalli