Overriding $Config{XXX}?

Overriding $Config{XXX}?

am 05.11.2005 01:50:39 von patrick.leboutillier

Hi all,

Is there an easy way to override certain $Config values for the
duration of the current script only?

I am writing a test suite for a Java project using Test::More and
Inline::Java, and there is a segfault that crashes the test suite. I
have tracked it down to $Config{useithreads} being defined on my
install, causing Test::More to do some thread-related initialisations,
which probably don't play nice with the threads in the Java (JNI) bit.

I know I can do it the hard way by mucking around in the Config
namespace (overriding Config::FETCH or untying $Config::Config and
replacing it with a regular hash, ...), and if that's the only way then
I'll write a small module to do that and put it on CPAN if none exists.

Thanks,

Patrick

Re: Overriding $Config{XXX}?

am 05.11.2005 06:53:48 von Sisyphus

wrote in message
news:1131151838.999065.216170@g44g2000cwa.googlegroups.com.. .
> Hi all,
>
> Is there an easy way to override certain $Config values for the
> duration of the current script only?
>

use ExtUtils::FakeConfig useithreads => 'undef';
print $Config::Config{useithreads};

The EU::FF module is really there to enable the building of extensions with
the MinGW (gcc) compiler on ActiveState perl (on Win32). However if you just
copy 'FakeConfig.pm' (into the appropriate location), and ignore all the
other instructions, I believe it will work on any platform (to the extent
that you can use it to override existing %Config values).

Hth.

Cheers,
Rob

Re: Overriding $Config{XXX}?

am 05.11.2005 11:50:54 von Sisyphus

"Sisyphus" wrote in message

> However if you just
> copy 'FakeConfig.pm' (into the appropriate location), and ignore all the
> other instructions, I believe it will work on any platform (to the extent
> that you can use it to override existing %Config values).
>

Didn't realise .... but EU::FC installs straight out of the box on non-Win32
operating systems by running, as per usual, 'perl Makefile.PL', 'make test'
and 'make install'. (No need to do any manual copying of FakeConfig.pm.)

Cheers,
Rob

Re: Overriding $Config{XXX}?

am 05.11.2005 16:01:01 von patrick.leboutillier

Rob,

Thanks. That's exactly what I was looking for.

Patrick