Subject: | Use of 'perl' rather than $^X breaks tests where the executable used is not the 'perl' in your path |
See the subject -- it's a bad idea to assume that the users perl binary is called 'perl' and may be found as the first entry of 'perl' in his or her path. You should use $^X instead.
One instance where i found this in the test suite for IO::All, but i recall reporting this before, so perhaps a grep of your code repository will show up more instances.
Patch for the failing test below.
[kane@myriad ~...IO-All-0.31]$ diff -u t/synopsis3.t.org t/synopsis3.t
--- t/synopsis3.t.org Tue Nov 30 10:38:32 2004
+++ t/synopsis3.t Tue Nov 30 10:38:59 2004
@@ -23,7 +23,7 @@
# # Copy STDIN to STDOUT
# io('-')->print(io('-')->slurp);
my $test1 = fix 'io("-")->print(io("-")->slurp)';
-open TEST, '-|', qq{perl -Ilib -MIO::All -e $test1 < t/mystuff}
+open TEST, '-|', qq{$^X -Ilib -MIO::All -e $test1 < t/mystuff}
or die "open failed: $!";
test_file_contents(<TEST>, 't/mystuff');
close TEST;
@@ -34,7 +34,7 @@
# $stdout->buffer($stdin->buffer);
# $stdout->write while $stdin->read;
my $test2 = fix 'my $stdin = io("-");my $stdout = io("-");$stdout->buffer($stdin->buffer);$stdout->write while $stdin->read';
-open TEST, '-|', qq{perl -Ilib -MIO::All -e $test2 < t/mystuff}
+open TEST, '-|', qq{$^X -Ilib -MIO::All -e $test2 < t/mystuff}
or die "open failed: $!";
test_file_contents(<TEST>, 't/mystuff');
close TEST;
@@ -46,7 +46,7 @@
# $string_out->print($line);
# }
my $test3 = fix 'my $stdin = io("-");my $string_out = io(q{$});while (my $line = $stdin->getline("")) {$string_out->print($line)} print ${$string_out->string_ref}';
-open TEST, '-|', qq{perl -Ilib -MIO::All -e $test3 < t/mystuff}
+open TEST, '-|', qq{$^X -Ilib -MIO::All -e $test3 < t/mystuff}
or die "open failed: $!";
test_file_contents(<TEST>, 't/mystuff');
close TEST;