delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/02/10/07:00:21

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=0.1 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <4B6EEA2E.3050601@bopp.net>
References: <a81c2f2d1002070721g30dbda89n44dda7ac80be6131 AT mail DOT gmail DOT com> <4B6EEA2E DOT 3050601 AT bopp DOT net>
Date: Wed, 10 Feb 2010 17:30:00 +0530
Message-ID: <a81c2f2d1002100400h6c7be221p915e57da7777f47b@mail.gmail.com>
Subject: Re: ActiveState Perl and Cygwin How To
From: "raphael()" <raphael DOT japh AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

On Sun, Feb 7, 2010 at 9:58 PM, Jeremy Bopp <jeremy AT bopp DOT net> wrote:
> 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=E0 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. =A0It 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. =A0e.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. =A0e.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. =A0For instance, say
> you're going to take option 2, then you can do the following:
>
> $ alias myscript.pl=3D"perl -S myscript.pl"
>
> Then you can run it the way you wanted with tab completion.
>
> -Jeremy
>
> --
> Problem reports: =A0 =A0 =A0 http://cygwin.com/problems.html
> FAQ: =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 http://cygwin.com/faq/
> Documentation: =A0 =A0 =A0 =A0 http://cygwin.com/docs.html
> Unsubscribe info: =A0 =A0 =A0http://cygwin.com/ml/#unsubscribe-simple
>
>

Thanks! Your ALIAS thing is wonderful though it escaped my mind.

alias myscript.pl

NICE ONE and thanks again.

--
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