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

I'm having a little problem having my cgi script recognize modules.
I have a script in a base directory. I then use the command

use TempOps::Temp.

I have a folder in that base directory called TempOps and a module called Temp.pm inside that directory.
The script complains that it can't find Temp.pm in @INC. Shouldn't it be able to find it in the folder?
Thanks.

Replies are listed 'Best First'.
Re: Module Placement
by blue_cowdawg (Monsignor) on May 24, 2001 at 21:54 UTC

    Well first questions I have are:

    1. What is the content of your @INC?
    2. Where have you installed your modules?

    With these two most crucial pieces of information we should be able to figure out where the problem is.

    In CGI environments that I've worked on before all the modules are "rooted" in the cgi-bin that the CGI scripts are running from.


    Peter L. BergholdSchooner Technology Consulting, Inc.
    Peter@Berghold.Netwww.berghold.net
Re: Module Placement
by nysus (Parson) on May 24, 2001 at 21:56 UTC
    Is this module installed locally? If so, you are going to need

    use lib '/site_path/directory_above_you_module's_directory';

    ...near the top of your script. This will give @INC an additional path to look for (and hopefully find) your module.

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar";
    $nysus = $PM . $MCF;

Re: Module Placement
by the_0ne (Pilgrim) on May 25, 2001 at 00:11 UTC
    Not sure if this is your problem or not, but I did find a bug in IIS 4.0 or 5.0 awhile ago where the root web that is displaying isn't actually the path. You have to enter it twice. I was going nuts trying to find out why the same thing as you mention was happening and then I checked google and found the answer. If this is the problem, all you have to do is change the root directory for your web by clicking Browse and you'll notice that the Browse does not take you to where the root is supposed to be. Find your root web folder and that should be all you have to do.

    Just in case that was your problem, if not, disregard.