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

Fellow Monks--

I'm running up against a sticky issue. One of my company's machines is running Perl with an incorrectly compiled @INC array, so any scripts calling modules won't run properly.

I've been using a temporary fixit by exporting the PERL5LIB environment variable in my shell profile. Of course, this works fine for command line scripts, but CGIs don't work.

I don't want to have to add the correct values to @INC every time that I write a script, so the obvious solution would be to recompile Perl with the correct @INC values. This leads to the problem: I've never compiled the Perl executable before, and I don't know how @INC gets assigned during the compile.

The Unix admins are expecting me to provide some kind of instructions on this, and I've searched Perl's documentation and all over the Web with no real results. I'm hoping that this means it is a moot point, and somehow the @INC thing takes care of itself when compiled, but I wouldn't know, and I can't find any helpful info on the subject.

By default, the perl build configuration does an extended question-and-answer session during the configuration. Default answers are provided and are sane for most questions. If you give an incorrect answer, it's best to start over. You get a chance to edit the configuration before it's written into the Makefile.

Since some default answers may be drawn from the current perl installation, pay close attention to the LIBDIR and 'additional @ISA' questions. The -d option to configure automatically picks most of the defaults, so don't try that with a broken current perl.

You might want to check your Config.pm and see if all the lib paths are correct. This might help you to correct the @INC array (it should, but I may be wrong). Hope this helps some.

Update: I should note that even though I looked at a Win32 Config.pm, some of the ideas should apply. I forget whether or not scripts/programs/etc. read from Config.pm unless explicitly stated (i.e., use Config;). If I am wrong, I'd like some correction on the issue.

Editing Config.pm won't help anything. It's written when Perl is compiled from the config.sh file built by Configure.sh. The basic @INC paths are compiled into the Perl binary itself. Think about it this way -- if Perl can be installed just about anywhere (and it can be), how would it know where to find Config to find out where the modules are installed?

I've never dug into this part of the Perl beast until now, and I've found it rather hard to locate documentation outlining the building of the Perl executable. Is there a handy source of documents on this subject (read: a URL that I can give to the Unix dudes), or is this coming purely from experience and the READMEs?

Thanks some more,

higle

Update: Whew, got it all sorted out. Thanks to Zaxo, I was able to confidently reassure the Unix guys (and their managers, so on and so forth) that the change would be a painless one. Perl was rebuilt and configured with the appropriate lib paths. Thanks again to everyone and their contributions!

The machine in question is running HP-UX, and I found one (1) document specific to building perl on that OS :c\

The problem was, Courage, without rebuilding the executable with the correct @INC, I would have to unshift(@INC, qw{dir dir dir...});all the scripts that I wrote on that machine, as well as look forward to explaining this whole thing to the other programmers who use that box. That would truly have been a bummer of cosmic proportions.