0

I need to invoke a perl script from cygwin but the script should be using the Windows perl and not cygwin perl.

# From Cygwin:
# This is correctly running under windows perl
cmd /c foo.pl

# foo's heirarchy
foo.pl
|--------> bar_1.pl
|--------> bar_2.pl
|--------> foobar/foobar.pl

As you see, foo.pl invokes a number of perl scripts internally. I want all of those to be run under Windows perl. What is happening is that foo.pl runs under Windows but all its children still run under cygwin perl. And unfortunately, I do not have the luxury of modifying foo.pl

So, how do I ensure that all the children perl scripts run under Windows perl? I know this is a

Vaibhav Desai
  • 2,618
  • 1
  • 16
  • 16

1 Answers1

0

Answering my own question. I figured I was taking the hard route by trying to make all the processes run under Windows. I came across this post How can I modify my cygwin environment to use Strawberry Perl instead of the packaged Perl distribution? and by changing the PATH locally in my script, the problem got solved. All is well now :)

Community
  • 1
  • 1
Vaibhav Desai
  • 2,618
  • 1
  • 16
  • 16
  • Changing your cygwin installation like this could be dangerous. Other cygwin tools could expect a real cygwin perl in /usr/bin/perl, and fail with Strawberry Perl. Maybe it would be better if you either change `$ENV{PATH}` to have the Strawberry bin path before `/usr/bin`, or to use `$^X` instead of `perl` when calling the scripts within `foo.pl`. – Slaven Rezic Sep 21 '13 at 08:43
  • Thank you Slaven. I exactly ended up doing what you mentioned. I'll edit my answer. – Vaibhav Desai Sep 21 '13 at 18:21