Recently put Strawberry Perl on a Windows 8.1 machine and discovered that exec
behaves differently with v5.8.8 in git-bash at /bin/perl
than with Strawberry at /c/strawberry/perl/bin/perl
. Here is the very simply script I found this with (purely by accident when playing with $PATH
):
#!/usr/bin/env perl
my $comment = "@ARGV" || 'update';
exec "git status; git add -A . ; git status; git commit -m '$comment'; git push";
This works fine with git-bash
(/bin/perl
), but when /c/strawberry/perl/bin/perl
is found ahead in the $PATH
the following error happens:
git: 'status;' is not a git command. See 'git --help'.
Did you mean this?
status
The code is identical in both cases. My hunch is that perl 5.18 in strawberry has changed the behavior of the exec
command itself, which has always been rather convoluted as it interprets arguments to it contextually (like perl loves to do).
My main concern is that somehow the two versions of perl render this rather simple bit of code incompatible between the perl versions and not some other simple system configuration issue, perhaps even an issue with the strawberry distro itself and not perl.
If this is a perl compatibility issue I am inclined to stick with v5.8.8, which does everything I'd ever want Perl to do for me (before going to another language).
Did the exec
perl statement change between these versions? I can find no evidence on the Internet that it has.
To recreate this behavior:
install git-scm.org on a windows machine:
- Download and install http://git-scm.org
- Fire up the git-bash shell
- Create a shell script and put the above code into it
- Set execute permission with chmod 755
- Ensure you are using /bin/perl with
which perl
- Execute the script
Then ...
- Install Strawberry Perl
- Set the $PATH to include /c/strawberry/perl/bin before everything else
- Check it with
which perl
- Execute the same script
This is the best way to understand what is happening and why the difference matters. The implications are that standard perl script written for git-bash (v5.8.8) will not work with 5.18 in strawberry. My next step is to install perl 5.18 on a Linux machine and make sure it behaves the same as a 5.8.8 there. If anyone has done this already please let me know.
Note: Using another operating system, while I would prefer it, is not an option in this case since we do other game development on these same machines that requires Windows.
Note: I use Perl instead of Bash because my little hacks tend to grow. I use Perl instead of Python or Node or because Perl comes standard with git-bash
and I therefore don't need another install on every student machine. I only put strawberry on there because I was looking to add back perlpod
functionality that git-bash
stripped.
To those who voted the question down. You simply prove why stackexchange is a poor excuse for accurate information and real help. Thank you for validating my decision to go back to IRC, where the real experts are, not those parading for a popularity contest.