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


On Sun, Feb 7, 2010 at 4:21 PM, raphael() <> wrote:
> Hello,
>
> I have been using Cygwin for quite some time now on Windows XP. I use
> Perl extensively and the scripts I use/create are fairly portable.
> I want to use ActiveState Perl as I can install many modules from CPAN
> that give me trouble in Cygwin using cpan install ...
>
> 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.
(snip)
> But what I want is that it should work directly like perlscr{TAB}
> {ENTER} and voilà working :)

How about something like this:

#!/bin/bash -x
args=$(cygpath -w ${1+"$@"})
# $0 not passed through cygpath
eval 'exec perl -x $0 ${args}'
if 0;
#! here begins the real perl -w
use strict;

$,=",";
print "$0 @ARGV";

__END__



Csaba
P.S. Can somebody explain what ${1+"$@"} does and why it's used
instead of just $@ ?
I hate doing cargo cult programming.
-- 
Life is complex, with real and imaginary parts

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