For Programmers: Free Programming Magazines  


Home > Archive > PERL Modules > November 2005 > Overriding $Config{XXX}?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Overriding $Config{XXX}?
patrick.leboutillier@gmail.com

2005-11-10, 6:56 pm

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

Sisyphus

2005-11-10, 6:56 pm


<patrick.leboutillier@gmail.com> 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


Sisyphus

2005-11-10, 6:56 pm


"Sisyphus" <sisyphus1@nomail.afraid.org> 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


patrick.leboutillier@gmail.com

2005-11-10, 6:56 pm

Rob,

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

Patrick

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com