inman has asked for the wisdom of the Perl Monks concerning the following question:

When a Perl distribution is compiled, the module Config.pm is created. This module contains the configuration information used by Perl applications to discover environmental features such as the location of the compiler. A problem arises when the information contained within Config.pm is outdated. Is there any way to update Config.pm or is it just a case of modifying the file directly?

The changes that I need to make are to update the location of the compiler and libraries to use when building CPAN modules. I currently edit the generated Makefiles to update the locations.

Replies are listed 'Best First'.
Re: Updating Config.pm
by etcshadow (Priest) on Jun 01, 2004 at 15:42 UTC
    Whether it's correct to or not, I know I have manually edited Config.pm. And it worked. Still, I think this may be akin to breaking the "warantee void if broken" tape on your perl install. :-D
    ------------ :Wq Not an editor command: Wq
Re: Updating Config.pm
by kvale (Monsignor) on Jun 01, 2004 at 15:43 UTC
    I don't see why you could not hand-edit Config.pm, although I have never needed to do so.

    I would find it more prudent, however, to recompile perl to its new location. That way everything is synchronized and you do not have to worry about missing crucial changes.

    -Mark

Re: Updating Config.pm (common)
by tye (Sage) on Jun 01, 2004 at 19:51 UTC

    Go grab any bundle of Perl for Win32 and in it you'll find an install script that does an automatic s/// on the contents of Config.pm in order to update the locations. I've also included such in bundles of Perl I've produced for Unix (long time ago, and those required that I s/// on the perl binary as well -- not that such is particularly difficult).

    - tye        

Re: Updating Config.pm
by duff (Parson) on Jun 01, 2004 at 16:52 UTC
    Why not create symbolic links between the new location and the old so that Config.pm is still correct?
Re: Updating Config.pm
by dcvr69 (Beadle) on Jun 01, 2004 at 17:21 UTC
    Is it not possible to copy Config.pm to another location, make the required changes, and include that new location in your PERL5LIB or -I when running perl Makefile.PL? Is it just another module, or is perl hardcoded to only look in that one location for it?
Re: Updating Config.pm
by BUU (Prior) on Jun 01, 2004 at 21:20 UTC
    Assuming we're talking about CPAN::Config.pm, it's created the first time you start the CPAN shell, if no Config.pm exists. An easy, simple way to edit it is just delete it, then next time you start CPAN.pm shell it'll reprompt you for all the various stuff.
      Well, there's a plain old root-level Config.pm, too... although I have to admit that when I earlier said that I had manually edited Config.pm, I was lying. I had actually edited CPAN::Config.pm (oops... I didn't remember till later).

      Specifically, it was because the prompt for entering a list of mirrors said to separate the mirrors by spaces and then hit enter (which I did), even though it actually wanted you to put each mirror on its own line (enter between each mirror). It was easier to edit CPAN::Config.pm than to go through the entire CPAN config process... espescially since it was pretty apparent where the config process steered me wrong.

      ------------ :Wq Not an editor command: Wq
      It looks like the OP was looking for the other Config.pm.

      Regarding CPAN::Config.pm, another (IMO better) way is to type "o conf init" (minus the quotes of course) at the CPAN prompt. CPAN will walk you through the configuration.

      The benefit of doing it this way is that CPAN will use your current configuration to provide the default responses.

Re: Updating Config.pm
by Anonymous Monk on Jun 02, 2004 at 08:07 UTC

    I often hand-edit site/lib/Config.pm and never had problems with it (as long the values are ok). Activestate has a script to relocate you perl location post-installation (cannot remember the name).

    Murat