develooper Front page | perl.perl5.porters | Postings from October 2003

win32 problem - munging arguments on command line

Thread Next
From:
Edward Peschko
Date:
October 22, 2003 02:15
Subject:
win32 problem - munging arguments on command line
Message ID:
20031021222004.GE29750@mdssirds.comp.pge.com
ok,

I've been running into a problem on win32 systems, which - at first glance - looks like 
it requires a mod to the way that perl handles its file name arguments.

If I make a script in cygwin's shell, something like this:


> cat /tmp/myscript.pl

#!/cygdrive/c/perl/bin/perl
print STDERR "HELLO WORLD\n";

> /tmp/myscript.pl

I get "Can't open /tmp/myscript.pl: no such file or directory." - This is because, for 
cygwin, '/tmp/myscript.pl' means actually C:\cygdrive\tmp\myscript.pl. 

For activestate's perl, it means: C:\tmp\myscript.pl

which is, of course a problem. It affects perl any time a filename or directory name
is expected, as in:

use lib '/whatever/path';


Now, of course I could affix a C:/.... to everything, and always use that form, but that
throws cross-platform portability out the window. And since my goal is to be able to
use the same code base on both unix and windows, it really isn't an option.

Or, I could compile and use cygwin's perl or mingw's perl, but those seem to have 
difficulties with the modules from ActiveState, and hence throw away the Win32 usability
.  And in any case, ideally the distributions should play along (ie: it shouldn't 
matter that you are running an msys perl on cmd.exe or in sh.exe(msys) or in 
sh.exe(cygwin).

The problem of course is that a change to perl's core code would be immense (I think)
in order to make this work, so I'm not sure what the best way to go is here. If I chose
ActiveState's perl, I lose some flexibility on the windows side of things. If I chose 
cygwin, I hinder my ability to make Win32 native apps. If I choose mingw, well, I 
seem to give up both ( because perl-5.8.1 isn't compiling cleanly on mingw).

What do people suggest? What's a clean solution?

Ed

(
   ps - about 'link' .. why doesn't it support reparse points? I was wrong about link and
   file links, but *directory* links 'link' definitely does not support. And considering
   that junction.exe creates, detects, and manipulates them fine, I'm not sure why the
   'link' function inside perl doesn't do the same.
)

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About