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

I am a new citizen of Perl country. Now I have a simple problem. I have a small program include two lines like this:

use lib /home/benjamin
use example

This program works ok in command line using 'perl test3.cgi', but when I access it in linux web server, I always got a problem. The error_log tells me this:
Can't locate example.pm in @INC (@INC contains /home/benjamin /usr/lib/perl/5.6.0 ...) at /var/www/cgi-bin/test3.cgi ...
I guarantee that the first path in @INC include example.pm, but why I have this problem?
thanks for all

Replies are listed 'Best First'.
Re: 'use xxx' doesn't work (boo)
by boo_radley (Parson) on Aug 22, 2001 at 01:18 UTC
    3 ideas :
    your webserver is typically under a different user id ("nobody"), and may (will) have different permissions to that particular directory.
    I think that the path in use lib needs to be quoted : use lib '/home/benjamin', but I could be wrong.
    also, you may be interested to see if your command line and web server are looking at the same perl : which perl may reveal discrepancies.

    and, uh, use strict. and diagnostics... *cough*

Re: 'use xxx' doesn't work
by dga (Hermit) on Aug 22, 2001 at 01:11 UTC

    My first guess is that the web server which runs as a user other than you cannot read the directory or file in question (or maybe some directory higher in the path)

    You can move the module to where the web server can see it (probablythe safest) or set up a directory where the web server can read in your area.