SPUG:running personal perl script through ActiveState perl from
cygwin
Michael R. Wolf
MichaelRunningWolf at att.net
Sun Jun 1 19:05:44 CDT 2003
Creede Lambard <creede at penguinsinthenight.com> writes:
> Have you tried running
>
> which perl
>
> in bash to see whether bash knows about perl and where it thinks the
> interpreter might be?
Yes, it was part of the ouptut that I posted.
bash-2.05b$ which perl
/cygdrive/c/Perl/bin/perl
> I was thinking that the shebang line is a Unix artifact that has no
> meaning in NT Perl -- at least I've been able to lead off Perl scripts
> with "#!/usr/bin/perl -w" on NT as long as I can remember with no ill
> effects -- but that's running them from the NT command line, not bash,
> and I have no idea what the differences between NT bash and Unix bash
> are. It's been a long time since I've used cygwin.
I think that the WinDOS loader looks at the first line and behaves
like this:
# Look for a she-bang, ignore up to (but require) "perl", then capture
# the flags in $1.
if ( $first_line =~ m[^#!.*perl (.*) ] ) {
$flags = $1;
# probably Unix-ish (not DOS-ish) filename
$filename = @ARGV[something_or_other];
# And here's the rub. It comes in Unix-ish from Cygwin, but needs
# to be DOS-ish for ActiveState perl.
system "perl.exe", $flags, $filename;
}
>
> On Sun, 2003-06-01 at 01:16, Michael R. Wolf wrote:
>> I guess I'm sitting in the stupid gas, I can't see my way out from
>> here. I just want to run a perl script on ActiveState perl while in a
>> cygwin bash.
>>
>> If it's a shebang line, I've missed the right one. I've failed by
>> trying these:
>> #! perl -w
>> #! /usr/bin/perl -w
>> #! /cygdrive/c/Perl/bin/perl -w
>> #! C:/Perl/bin/perl -w
>> #!
>> and
>> no shebang line.
>>
>> I think it's a problem with the difference between how NT sees the
>> file system and how cygwin sees the filesystem. I'm betting that
>> cygwin finds the script in the Unix-like filesystem, but perl.exe sees
>> the filesystem as NT-like. Just a guess, but if that guess is correct,
>> is there a shebang line that can bridge them, or do I need some other
>> kinda' magic?
>>
>>
>> bash-2.05b$ mount
>> C:\cygwin\usr\X11R6\lib\X11\fonts on /usr/X11R6/lib/X11/fonts type system (binmode)
>> C:\cygwin\bin on /usr/bin type system (binmode)
>> C:\cygwin\lib on /usr/lib type system (binmode)
>> C:\cygwin on / type system (binmode)
>> c: on /cygdrive/c type user (binmode,noumount)
>> m: on /cygdrive/m type user (binmode,noumount)
>> r: on /cygdrive/r type user (binmode,noumount)
>> bash-2.05b$ echo $PATH
>> /home/toshiba/bin:/usr/bin:/usr/local/bin:/cygdrive/c/emacs-21.2/bin:/cygdrive/c/Perl/bin:/cygdrive/c/WINNT/system32:/cygdrive/c/WINNT:/cygdrive/c/WINNT/System32/Wbem
>> bash-2.05b$ pwd
>> /home/toshiba/bin
>> bash-2.05b$ ls mrw_ping.pl
>> mrw_ping.pl
>> bash-2.05b$ which mrw_ping.pl
>> /home/toshiba/bin/mrw_ping.pl
>> bash-2.05b$ which perl
>> /cygdrive/c/Perl/bin/perl
>> bash-2.05b$ ls -l $(which perl)
>> -rwxrwxrwx 1 Administ SYSTEM 20480 Dec 1 23:16 /cygdrive/c/Perl/bin/perl
>> bash-2.05b$ mrw_ping.pl
>> Can't open perl script "/home/toshiba/bin/mrw_ping.pl": No such file or directory
>> bash-2.05b$
>>
>>
>>
>>
>> Whadda' ya mean, "No such file"?
>>
>> Who "Can't open perl script..."?
>> cygwin
>> perl.exe
>> NT
>> she-bang loader
>>
--
Michael R. Wolf
All mammals learn by playing!
MichaelRunningWolf at att.net
More information about the spug-list
mailing list