----- Original Message ----- From: "Cal Henderson"

Hi Inline folks,

I maintain a bunch of Inline ILSM modules (nothing spectacular) and I'm forever getting CPANTesters failure reports because of config registry caching. This is from Inline.pod:

----------
The 'config' Registry File

Inline keeps a cached file of all of the Inline Language Support Module's meta data in a file called config. This file can be found in your DIRECTORY directory. If the file does not exist, Inline creates a new one. It will search your system for any module beginning with Inline::. It will then call that module's register() method to get useful information for future invocations.

Whenever you add a new ILSM, you should delete this file so that Inline will auto-discover your newly installed language module.
----------

Is there a sensible way to delete this config file as part of module installation? It looks like I could run `use Inline _CONFIG_` to force a rebuild, but that's undocumented.

I couldn't get that to work - kept on getting:

##################################
Can't open \config-MSWin32-x86-multi-thread-5.012000 for output.


at -e line 1
BEGIN failed--compilation aborted at -e line 1.
##################################

I guess, at the beginning of the test script (before anything else is done), it's just a matter of determining the directory that the config file is in, and then deleting that file if it exists.

I think (ie completely untested) that the safest way of determining that location would be to specify it using the DIRECTORY config option. I'm thinking something like:

################################
use Config;
BEGIN {
unlink "_Inline_SMITH/config-${Config::Config{archname}}-$]"
 if -e "_Inline_SMITH/config-${Config::Config{archname}}-$]";

mkdir('_Inline_SMITH', 0777) unless -e '_Inline_SMITH';
};
use Inline Config =>
 DIRECTORY => '_Inline_SMITH';

[then your tests ...]
################################

That won't work if the cpan testers override that DIRECTORY setting .... can they do that ? (I don't know.)

For the future, perhaps Inline could provide a 'REMOVE_CONFIG' config option - set initially to 0. Then, in Inline.pm's sub check_config_file(), immediately prior to:

#################################
$o->create_config_file($DIRECTORY)
 if not -e File::Spec->catfile($DIRECTORY, $configuration_file);
#################################

we could have:

##################################
if($o->{CONFIG}{REMOVE_CONFIG}) {
 unlink(File::Spec->catfile($DIRECTORY, $configuration_file))
 if -e File::Spec->catfile($DIRECTORY, $configuration_file);
}
##################################

Then it's just a matter of specifying 'use Inline Config => REMOVE_CONFIG => 1;' in the test script.

I think I'll put that in place in the next Inline release, unless someone points out reasons for *not* doing that.

Cheers,
Rob




Reply via email to