Re: Finding "this file name".
- From: "Paul Lalli" <mritty@xxxxxxxxx>
- Date: 25 Jan 2006 09:57:53 -0800
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
.
- Follow-Ups:
- Re: Finding "this file name".
- From: Howard Charles
- Re: Finding "this file name".
- References:
- Finding "this file name".
- From: hbest
- Re: Finding "this file name".
- From: usenet
- Re: Finding "this file name".
- From: hbest
- Re: Finding "this file name".
- From: usenet
- Re: Finding "this file name".
- From: Paul Lalli
- Re: Finding "this file name".
- From: Howard Charles
- Re: Finding "this file name".
- From: Paul Lalli
- Re: Finding "this file name".
- From: Howard Charles
- Finding "this file name".
- Prev by Date: Re: Finding "this file name".
- Next by Date: Re: Reference question
- Previous by thread: Re: Finding "this file name".
- Next by thread: Re: Finding "this file name".
- Index(es):
Relevant Pages
|