This is the mail archive of the cygwin 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]
Other format: [Raw text]

RE: activestate perl on cygwin

Offer an alternative. As I mentioned in my original post, I got this script
online. In using it I found it was not sufficient, I started this thread in
the hopes that someone would provide me with a better wrapper script.
Instead I got a bunch of replies about how it is a bad idea to use
Activestate with cygwin. My scripts are written to make my life on Windows
easier, so that means using Windows specific code to automate common tasks.
Ideally I'd prefer to stay in a pure Linux environment, but for reasons I do
not need to go into, I am stuck with Windows. It was my understanding that
the intent of this mailing list was to offer a place to discuss issues
involving cygwin and develop solutions to those problems. Seeing as I do not
have a whole lot of free time to research a better solution, I hoped a quick
answer would be provided via this medium. While I appreciate the suggestions
that have been made on this thread, I want to install two copies of the perl
interpreter or port my existing scripts to cygwin as that appears to be the
compromise. Are there any other ideas?

-----Original Message-----
From: [] On Behalf Of
Igor Peshansky
Sent: Wednesday, January 10, 2007 9:06 AM
To: Kevin T Cella
Subject: Re: activestate perl on cygwin

On Mon, 8 Jan 2007, Kevin T Cella wrote:

> I understand the trouble with using Activestate perl on cygwin is the
> path conversion problem. Searching online I found the following wrapper
> script useful for most perl commands:
> 	#! /bin/sh
> 	# This is necessary to make perl work with cygwin.  Cygwin passes
> 	# "cygwin style" paths to the program in the #! statement and
> 	# perl does not know what /cygwin/d/... means.
> 	#
> 	# So, we put #!/usr/local/bin/perl in the perl script and this is
> 	# This routine translates the path name to something of type d:/
> 	#
> 	args=""
> 	while [ $# -gt 0 ]
> 	do
> 	    var="$1"
> 	    shift
> 	    if test "`echo $var | grep '/'`" = "$var"
> 	    then
> 	        # cygpath does the /cygwin/d/ to d:/ conversion
> 	        var=`cygpath -w $var`
> 	        # Then we have to swap \ for / (extra \ needed because the
> 	        # shell makes a first pass at removing the \.
>       	  #
> 	        var=`echo "$var" | sed 's/\\\/\\//g'`
> 	    fi
> 	    args="$args $var"
> 	done
> 	# Finally the command is to call perl with the name of the script
and the args.
> 	#
> 	/c/Perl/bin/perl.exe $args
> An example of one that does not work is as follows:
> 	perl -e 'print join "\n", @INC, "\n";'
> For some reason, the script above strips the single quotes from the
> command and therefore does not execute the command properly. Please
> advise.

The reason the script above strips the single quotes from the command is
because it's buggy.  Not only that, it'll be pretty slow, as it'll spawn a
'test' and a 'sed' for every argument.  And, judging from the comments,
its intended purpose is to allow invoking perl with a script filename, not
with a literal script.  Oh, and there's a typo in the comment --
"/cygwin/d" should be "/cygdrive/d".

However, none of these issues are Cygwin-specific (with a possible
exceptions of the typo and using "cygpath -m" instead of "cygpath -w" to
save yourself the trouble of the extra backslash translation).  Any good
tutorial on bash should show you how to properly quote the arguments.
You may also want to search the Cygwin list archives, where this exact
issue comes up once in a while (usually in the context of paths with
      |\      _,,,---,,_ |
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Freedom is just another word for "nothing left to lose"...  -- Janis Joplin

Unsubscribe info:
Problem reports:

Unsubscribe info:
Problem reports:

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