Click here to get back home

Overriding $Config?

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Overriding $Config? patrick.leboutillier@gmail.com 11-04-2005
Posted by patrick.leboutillier@gmail.com on November 4, 2005, 4:50 pm
Please log in for more thread options


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 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



Posted by Sisyphus on November 5, 2005, 4:53 pm
Please log in for more thread options



> 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;

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




Posted by Sisyphus on November 5, 2005, 9:50 pm
Please log in for more thread options




> 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




Posted by patrick.leboutillier@gmail.com on November 5, 2005, 7:01 am
Please log in for more thread options


Rob,

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

Patrick




Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap