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: Question on Perl (.pl) association


On Wed, 17 Mar 2004, zzapper wrote:

> Hi,
> Currently I'm getting round this by writing a simple wrap for my perl
> scripts. I use ActiveState Perl for historical reasons.
>
> eg
>
> #!/bin/bash
> # tipftp
> # description :Wrap for tipftp.pl
> c:/usr/local/bin/perl c:/cygwin/usr/local/bin/tipftp.pl
>
> zzapper (vim, cygwin, wiki & zsh)

I believe I posted this before, but here it goes again.  If all you want
to do is make 'shebang' ('#!') work with ActiveState (or other Windows
programs), put the following in your /usr/local/bin:

--------------------- BEGIN /usr/local/bin/wrap ---------------------
#!/bin/sh
pname="$1"
fname="`cygpath -wi "$2"`"
shift 2 && exec "$pname" "$fname" "$@"
------- Warning: cutting here may damage your screen surface --------

and then use it in the '#!' line of your script, e.g.,

------------------------ BEGIN activeperl.pl ------------------------
#!/usr/local/bin/wrap /cygdrive/c/ActivePerl/bin/perl
use English;
print "Testing: $PERL_VERSION on $OSNAME\n";
------- Warning: cutting here may damage your screen surface --------

or, in your case, '#!/usr/local/bin/wrap /cygdrive/c/usr/local/bin/perl'.
Note that this won't suddenly make your perl program understand POSIX
paths, i.e., if you want to pass a filename to that script, you'd have to
convert it yourself with `cygpath -w`...  Also beware the possible shebang
length limit...
HTH,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

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


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