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

Dear monks,

I have a perl script that was working fine, and then for some reason or the other it stopped working. Here's the error I'm getting.

Can't locate config.cgi

And Here's the line of code it's referring to.

require "config.cgi";

This is the configuration file. This file is in the same folder with the perl script.

Any ideas?

Thanks,
Bz

Never mind. I put in the entire location for the file and it worked.

Replies are listed 'Best First'.
Re: Can't locate config.cgi
by tachyon (Chancellor) on Nov 08, 2004 at 22:09 UTC

    Alternatively to a permissions issue your perl may not have . (the cwd) in @INC, thus it won't look for config.cgi in the current dir. In which case you want:

    use lib '.'; require 'config.cgi';

    cheers

    tachyon

Re: Can't locate config.cgi
by larryp (Deacon) on Nov 09, 2004 at 05:42 UTC

    If you're using IIS, this can be confusing. IIS 5 recognizes relative paths, but they're relative to the root of the site, so including './config.cgi' would look for '/config.cgi'.

    IIS 6, on the other hand, recognizes relative paths in the traditional sense, and and would look for './config.cgi' in the current directory.

    Had to deal with this headache myself a little while back. :)

    /Larry

Re: Can't locate config.cgi
by Aighearach (Initiate) on Nov 08, 2004 at 20:23 UTC
    The webserver probably doesn't have read permissions of the file. If it's unix/linux try chmod a+rx config.cgi or (better) set the owner to the webserver user.

    --
    Snazzy tagline here