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

Can anyone share with me info regarding the Config.pm file and the @INC array. I am facing issue with a recently installed new version perl v 5.8.3 in the path /usr/bin of one of the unix servers. I found the following error:

conmid02: cd /usr/bin
conmid02: perl -V
Can't locate Config.pm in @INC (@INC contains: /usr/local/lib/perl5/5.8.3/sun4-solaris /usr/local/lib/perl5/5.8.3 /usr/local/lib/perl5/site_perl/5.8.3/sun4-solaris /usr/local/lib/perl5/site_perl/5.8.3 /usr/local/lib/perl5/site_perl/5.6.0 /usr/local/lib/perl5/site_perl .). BEGIN failed--compilation aborted.

the content of the @INC array is as follows in my machine:

conmid02: perl -e "print join(\"\n\", @INC);"
/usr/local/lib/perl5/5.8.3/sun4-solaris
/usr/local/lib/perl5/5.8.3
/usr/local/lib/perl5/site_perl/5.8.3/sun4-solaris
/usr/local/lib/perl5/site_perl/5.8.3
/usr/local/lib/perl5/site_perl/5.6.0
/usr/local/lib/perl5/site_perl


Can anyone please help me here. I am facing big loss in business due to this.

Replies are listed 'Best First'.
Re: Config.pm file and @INC array
by perrin (Chancellor) on Feb 25, 2009 at 16:01 UTC
    Something is very wrong with your new perl install. My guess is that "perl" is actually pointing to your old perl and that some of it got overwritten or otherwise wrecked. Check it with "which perl" and see if it's the one you installed. Most likely you're going to need to reinstall at least your own perl and possibly your system's perl as well.
Re: Config.pm file and @INC array
by tirwhan (Abbot) on Feb 25, 2009 at 15:50 UTC

    The error message means that you don't have the Config module installed (or at least not installed correctly). @INC contains a list of directories which perl will search for installed modules and Config.pm can not be found in any of them. I'm unsure what exactly the best way of obtaining the correct version of Config.pm for your platform is (I don't use Solaris myself), but maybe there's something in the Solaris docs that will tell you.

    However:

    ... with a recently installed new version perl v 5.8.3

    This seems to be the real problem. Why on earth would you install a 5-year old version of perl on your (apparently production-)machine? There have been numerous bug and security fixes in perl since then, so you should take advantage of them. The current version of perl 5.8 is 5.8.9, install that or at least something a lot closer to it, otherwise I predict you'll have a lot more problems.


    All dogma is stupid.

      The error message means that you don't have the Config module installed

      Config is not an installable module. Config is not just a part of Perl, it's built along with Perl. (It contains build options and system capabilities.) Something's very wrong here since Perl can't find itself.

        Thanks for the clarification. I thought It'd be something like that and was confused by the fact that neither the search.cpan.org perl core module list nor perl -MModule::CoreList -e 'Module::CoreList->first_release("Config")' showed it, but this makes perfect sense of course.

        Update: and of course, the search.cpan.org list does show it, it's just under "Documentation" rather than "Modules". sigh


        All dogma is stupid.
      Hi,
      I do understand that the version of perl is quite old, but as I said, this is what my business requires currently. Can you please help me get some suggestions as to how to go after this issue.

      I must say that there are currently two versions of perl installed in my system. 5.6.0 under /usr/local/bin and 5.8.3 under /usr/bin. The same can be found in the list of @INC.

      What I am basically looking for is that if someone can help me know how can i modify the @INC list to add "/usr/lib/perl5/5.8.3". I guess this may solve the issue. Can you throw some light in here.


      Thanks,
      vikram
        how can i modify the @INC list to add "/usr/lib/perl5/5.8.3"

        You can set the environment variable PERL5LIB to add directories to @INC, but it's probably almost certainly a better idea to install the Perl libs that belong to a certain Perl version right where the respective Perl binary looks anyway (those @INC paths you see, which are hardcoded in the binary — in your case /usr/local/lib/perl5/5.8.3/...).

        (Update: and if you decide to use PERL5LIB, set it locally only for exactly the processes that need it (e.g. in wrapper scripts)...  Setting PERL5LIB globally on a system with multiple Perl versions is asking for trouble!)

        perhaps you can just create links in /usr/local:

        ln -s /usr/{,local/}lib/perl5/5.8.3 ln -s /usr/{,local/}lib/perl5/site_perl/5.8.3
Re: Config.pm file and @INC array
by cdarke (Prior) on Feb 25, 2009 at 17:08 UTC
    Check the date/time stamps on perl executables with ls -l /usr/bin/*perl*. My guess is that you are picking up an old binary.
Re: Config.pm file and @INC array
by locked_user sundialsvc4 (Abbot) on Feb 27, 2009 at 01:02 UTC

    AFAIK, the basic content of the @INC list is determined from:   (in order...)

    1. use lib directives
    2. the PERL5LIB environment-variable
    3. the -m command-line parameter
    4. a hard-coded base list built into Perl itself.
    (See: perldoc perlrun)

    It superficially appears to me that the hard-coded base list might not have been specified as you intended on those Unix boxes. perl -V (note: uppercase “V”) should give you a lot of useful information.

    Especially for production (web...) applications, I tend to steadfastly use use lib directives. (This is, of course, essential with “taint mode.”) I like for the behaviors of the system to be absolutely predictable and repeatable.

    To that end, I also regularly use use FindBin qw($Bin);, which places into the variable $Bin the location of the current executable. If the sub-directory structure of the app is known but the root-directory name is not (e.g. web app on shared-hosting), you don't have to diddle with filenames quite so much when moving from development to production servers.