Subject: | $^X in Wav.pm breaks with mod_perl |
Audio::Wav does this in its BEGIN block:
my $inline_c_ok = `$^X -e "require Inline::C; eval { Inline->import(C => q[int foo() { return 0; }]) }; print \\\$\@ ? 0 : 1"`;
The problem is that when running in mod_perl, $^X is not "/usr/bin/perl" but "/usr/lib/apache2/mpm-itk/apache2" or something equivalent.
So the test runs something random which luckily doesn't take a -e argument (it also spews usage errors into my apache logs).
I'm guessing the same thing happens on anything that embeds a perl interpreter.
Replacing the code with the following fixes the issue for me:
use Config;
my $perl = $Config{perlpath};
$perl .= $Config{_exe} unless $perl =~ m/$Config{_exe}$/i;
my $inline_c_ok = `$perl -e "require Inline::C; eval { Inline->import(C => q[int foo() { return 0; }]) }; print \\\$\@ ? 0 : 1"`;
And you could probably just get away with this if you don't care about windows:
use Config;
my $inline_c_ok = `$Config{perlpath} -e "require Inline::C; eval { Inline->import(C => q[int foo() { return 0; }]) }; print \\\$\@ ? 0 : 1"`;
-David