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 and Cygwin How To


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


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