How can I modify my cygwin environment to use Stra

2019-02-06 08:35发布

I currently use Strawberry Perl as my primary Perl distribution. However, I have some applications that make Perl calls through cygwin. These generally fail because they are calling the version of Perl that was packaged with cygwin, and only looking in cygwin's lib folders. How can I modify my cygwin environment to call Strawberry Perl (and use the C:/strawberry/perl/lib dirs) instead?

8条回答
ら.Afraid
2楼-- · 2019-02-06 09:13

If you don't want to mess around with any paths or do anything permanent there is an easy TEMPORARY hack. Type "where perl" at Cygwin sh prompt. It will list all the Perl.exe it sees in PATH in their order of execution. Change the names of the ones you don't want to be seen that get listed before the perl you want to use. But DO remember to change them back when you are done or you might have a few problems down the road.

查看更多
不美不萌又怎样
3楼-- · 2019-02-06 09:17

One good thing I can add is that if you get the right perl to come first in the path, it should handle site-specific CPAN modules you may have installed with strawberry perl running in a CMD shell.

"which perl" is your friend.

If you had trouble with this, you could set the PERL5LIB environment variable, but it shouldn't be necessary.

I still pass in DOS-style file paths as parameters into the perl script, i.e. "d:\data\myfile.txt", not "/cygdrive/d/data/myfile.txt". So oddly enough, this mix of path notation works:

bash> /cygdrive/d/scripts/myscript.pl d:\data\myfile.txt

查看更多
登录 后发表回答