This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Why can't I run perl scripts after cd to /_/d i.e. d:


On Thu, Jul 06, 2000 at 05:12:19PM -0400, Tolkin, Steve wrote:
>> -----Original Message-----
>> From: Chris Faylor [mailto:cgf@cygnus.com]
>> Sent: Wednesday, July 05, 2000 9:24 PM
>> To: cygwin@sourceware.cygnus.com
>> Subject: Re: Why can't I run perl scripts after cd to /_/d i.e. d:
>> 
>>It certainly sounds like this is not a cygwin version of perl and so it
>>does not understand cygwin paths.
>
>Indeed it is not a cygwin version of perl.  But I do not understand
>what you mean "it does not understand cygwin paths".  The path it
>cannot seem to find is the path to the executable, on the first line of
>the script, i.e.  #/usr/bin/perl Is this what you mean?

It cannot find the path to the script:

> /usr/home/mybin/testperl
> >Can't open perl script "/usr/home/mybin/testperl": No such file or directory

>But why can't it find that?

When Cygwin sees a "#!/usr/bin/perl" line at the start of a script
called "/usr/home/mybin/testperl", it is translated to:

perl /usr/home/mybin/testperl

A non-cygwin version of perl will not understand the path
"/usr/home/mybin/testperl" if you are not running on the c: drive
since, from your mount table, /usr/home/mybin translates to
c:\usr\home\mybin.

If you are running this from a d: drive then the Windows default way
of doing things would be to interpret /usr/home/mybin/testperl as
d:\usr\home\mybin\testperl which doesn't exist, of course.

>One of the things I like about Perl is that the identical scripts can
>be run on both NT and Unix, provided I have a copy of the the perl
>program in the same place, i.e.  /usr/bin/perl
>
>Are you saying that if I am in a cygwin bash shell, and happen to be on
>a drive other than c:, my perl scripts will not work?  If this is
>really true I hope there is a workaround.  Otherwise this is a
>showstopper problem for me.  Or am I misunderstanding?

You're not misunderstanding.  Non-cygwin tools do not understand cygwin
paths.

The only fix that I am aware of is to run a cygwin version of perl.
Chuck Wilson supports a perl port at his CygUtils site.  Check out
the http://sources.redhat.com/cygwin/  "Related Software" link.

>The following shows that even running in a DOS box and in D: the perl script
>works correctly, provided I have associated the extension .pl with the Perl
>program.
>
>C:\usr\home\mybin>cat testperl.pl
>#!/usr/bin/perl
>print "hello from testperl\n";
>
>C:\usr\home\mybin>assoc .pl
>.pl=Perl
>
>C:\usr\home\mybin>d:
>
>D:\>testperl.pl
>hello from testperl

Sure.  Windows is translating this to:

Perl c:\usr\home\mybin\testperl.pl

which would work correctly.  The native Windows version of perl is getting
windows paths.

cgf

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]