delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/02/07/11:29:14

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00
X-Spam-Check-By: sourceware.org
Message-ID: <4B6EEA2E.3050601@bopp.net>
Date: Sun, 07 Feb 2010 10:28:30 -0600
From: Jeremy Bopp <jeremy AT bopp DOT net>
User-Agent: Thunderbird 2.0.0.23 (X11/20090817)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: ActiveState Perl and Cygwin How To
References: <a81c2f2d1002070721g30dbda89n44dda7ac80be6131 AT mail DOT gmail DOT com>
In-Reply-To: <a81c2f2d1002070721g30dbda89n44dda7ac80be6131@mail.gmail.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

raphael() wrote:
> The problem is that AS Perl cannot find the Perl script I invoke on
> the command line as the script's PATH that Cygwin reports to AS Perl
> is a unix one i.e. /cygdrive/c/cygwin/home/.../bin whereas AS Perl
> requires it in C:\cygwin\home\...\bin\. The Perl script is in PATH.
> 
> This happens only with AS Perl (duh) as it requires backslash
> delimited path. I have searched somewhat on the web regarding this but
> haven't found anything.
> There are bash scripts that act in between and convert unix path to
> windows before invoking AS Perl but you still have to give it complete
> script path like
> 
> $ bash_convert.sh /home/.../bin/perlscript.pl -h
> 
> this will give C:\Perl\bin\perl.exe C:\cygwin\home\...\bin\perlscript.pl -h
> 
> But what I want is that it should work directly like perlscr{TAB}
> {ENTER} and voilą working :)
> 
> Any Ideas?

The problem is that ActivePerl is a Windows program, and as such cannot
use POSIX paths (/cygdrive/c/...) as produced by Cygwin.  It has nothing
to do with the slashes since Windows programs can use paths with either
kind, even a mix, so long as they are Windows paths (C:\Program Files\...).

You have two options available to you:

1) Use the cygpath program to convert the paths as needed so that you
can send the paths to your scripts.  e.g.)

$ perl "$(cygpath -w /path/to/myscript.pl)"

2) Put your files into PATH and tell perl to find them for itself using
the -S option.  e.g.)

$ perl -S myscript.pl


With either option you can wrap the action you choose with another
script or shell alias to hide what is actually going on so that you can
get what you want when interacting with the shell.  For instance, say
you're going to take option 2, then you can do the following:

$ alias myscript.pl="perl -S myscript.pl"

Then you can run it the way you wanted with tab completion.

-Jeremy

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019