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

I'm 75% through "Perl in 21 Days" (more like Perl in 1 1/2 months for me).

I understand that one can install a perl module into the regular old cgi-bin outside of the lib subdirectory. Then you put a pragma in your script so the script can find it (or so the book says).

But what happens if you want to call two modules: one that is in the perl lib and one that is in the cgi-bin? Will the script get confused? How does this all work?

  • Comment on Module installation outside of perl lib

Replies are listed 'Best First'.
Re: Module installation outside of perl lib
by BMaximus (Chaplain) on Mar 24, 2001 at 05:34 UTC
    To tell perl that another directory also holds modules/scripts that you are using you put in:

    use lib '/dir/where/stuff/is';

    What this does is that it pushes that directory into @INC and Perl looks in the directories that are contained in @INC for the modules that it needs. So if the module/script you are using doesn't find what it needs in the base directory where the script is located then it will look through the directories that are in @INC.

    Hope this answeres your question,
    BMaximus

    update: Ick, slight mistake corrected.
      Yes, answers it perfectly. Thanks, man.