Skip Menu |

This queue is for tickets about the Audio-Wav CPAN distribution.

Report information
The Basics
Id: 62060
Status: resolved
Priority: 0/
Queue: Audio-Wav

People
Owner: Nobody in particular
Requestors: david [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.12
Fixed in: 0.13



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
From: mario [...] toursprung.com
I confirm too the issue with the $^X under mod_perl. Further one needs to create and set the proper permissions for the _Inline directory in order Inline to be able to compile and execute its stuff. In my particular case I had to create an /_Inline directory. I attached a small patch for the Inline::C check On Mon Oct 11 18:45:51 2010, david wrote: Show quoted text
> 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
Subject: Wav.pm.0.12.patch
--- Wav.pm.orig 2012-02-15 00:21:20.910434977 +0100 +++ Wav.pm 2012-02-15 00:54:49.215417028 +0100 @@ -1,5 +1,6 @@ package Audio::Wav; +use Config; use strict; eval { require warnings; }; #it's ok if we can't load warnings @@ -18,7 +19,11 @@ # result in errors about @INC. hack around this by launching a # seperate process instead of simply checking $@ after: # eval { Inline->import(C => "int foo() { return 0; }\n"); }; - my $inline_c_ok = `$^X -e "require Inline::C; eval { Inline->import(C => q[int foo() { return 0; }]) }; print \\\$\@ ? 0 : 1"`; + my $secure_perl_path = $Config{perlpath}; + if ($^O ne 'VMS') + {$secure_perl_path .= $Config{_exe} + unless $secure_perl_path =~ m/$Config{_exe}$/i;} + my $inline_c_ok = `$secure_perl_path -e "require Inline::C; eval { Inline->import(C => q[int foo() { return 0; }]) }; print \\\$\@ ? 0 : 1"`; if($inline_c_ok) { $Audio::Wav::_has_inline = 1; } else {
Thanks, Mario and David, and sorry it took so long to fix this simple problem. I've applied something between your two patches and uploaded it to SVN. It will be released with 0.13 this weekend. If you want to send me your names to be included in the Changes file, feel free (otherwise you will be credited by first name only) Thanks! Brian