|
Posted by smallpond on May 12, 2008, 8:52 pm
Please log in for more thread options
On May 12, 5:27 pm, j...@toerring.de (Jens Thoms Toerring) wrote:
> Hello,
>
> a CPAN module of mine that needs a C compiler for installation
> fails in some of the tests since the C compiler isn't found. The
> offending lines are
>
> if ( system $Config, qw( -o cc_test cc_test.c ) ) {
> unlink 'cc_test.c';
> die "Can't run C compiler '$Config'\n";
>
> }
>
> where 'cc_test.c' is a simple program that gets created
> automatically just for this test.
>
> The problem is that on one of the testers machines $Config
> is set to 'ccache cc' and system() obviously does not like the
> space in the name of the program it's supposed to execute.
>
> Now I probably can get around that by using a line like
>
> if ( system split /\s+/, $Config, qw( -o cc_test cc_test.c ) ) {
>
> or something similar but it looks ugly and I suspect that there
> is a better method to invoke the correct C compiler. Does anybody
> have an idea?
> Thanks and regards, Jens
> --
> \ Jens Thoms Toerring ___ j...@toerring.de
> \__________________________ http://toerring.de
system fails because you are passing part as a string and
part as a list. Just pass a single string and let system
do the parsing.
if (system "$Config -o cc_test cc_test.c")
--S
|