Fri Nov 23 20:17:08 2012: Request 81375 was acted upon.
Transaction: Correspondence added by SISYPHUS
Queue: Inline
Subject: chdir without cc
Broken in: 0.50
Severity: Normal
Owner: Nobody
Requestors: bernhard+c...@lsmod.de
Status: new
Ticket https://rt.cpan.org/Ticket/Display.html?id=81375 >
On Fri Nov 23 07:52:45 2012, bmwiedemann wrote:
> I used Inline C in eval
> to make optional acceleration
> and fallback to generic perl if unavailable,
> but this failed when no gcc was installed,
> because Inline would chdir to the _Inline/build/xxx_ dir
> and remain there when the program started
>
> This caused errors with modules in "." not being found
> and output files going to the wrong place.
Could you post a simple demo script ? I can't reproduce the problem.
I tried the following test script:
use strict;
use warnings;
eval {
require Inline; Inline->import (C => Config =>
BUILD_NOISY => 1);
require Inline; Inline->import (C =><<' EOC');
int foo() {
warn("Using Inline\n");
return 42;
}
EOC
};
# If Inline is unavailable, foo() simply calls
# the sub bar() pure perl implementation.
if($@) {
*foo =\&bar;
}
sub bar {
warn("Using Pure Perl Implementation\n");
return 42;
}
my $x = foo();
print "$x\n";
If I hide cc (gcc.exe in my case), the build fails for that reason, and
the script falls back to the pure perl implementation (sub bar).
This is as it's meant to be, and as it should be.
Cheers,
Rob