G'day Carlos,

I'd be reasonably certain your problem is that the directory 'lib' is not tied to an absolute path. Note how all the other @INC paths start with /usr/....

I can emulate your problem like this.

Create a directory called ~/tmp/pm_11124087/lib and add this module to it:

$ cat ~/tmp/pm_11124087/lib/XYZ.pm package XYZ; 1;

In ~/tmp/pm_11124087, create this script:

$ cat ~/tmp/pm_11124087/test_lib.pl #!/usr/bin/env perl use strict; use warnings; use lib 'lib'; use XYZ;

If I run that script from ~/tmp/pm_11124087, all is good:

$ ./test_lib.pl $

However, if I go up one directory:

$ cd .. $ pm_11124087/test_lib.pl Can't locate XYZ.pm in @INC (you may need to install the XYZ module) ( +@INC contains: lib /home/ken/...

So that's basically your problem reproduced.

I think you were on the right track with FindBin but left off the 'lib' directory. I can fix my problem like this:

$ cat ~/tmp/pm_11124087/test_lib.pl #!/usr/bin/env perl use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; use XYZ;

So the earlier issues go away:

$ ./test_lib.pl $ cd .. $ pm_11124087/test_lib.pl $

I don't know what your directory structure is: you may need to adjust the path in use lib "$FindBin::Bin/lib"; to suit your setup.

You reported you checked for the existence of 'lib'. You should also check that conf.cgi is actually in that directory and that you have appropriate permissions to access both the directory and the file. Given your initial report included "webmaster", those permissions may relate to your web server, not your personal permissions; e.g. user web needs read permission, not just user carlos.

See also: FindBin and lib.

— Ken


In reply to Re: Can't locate conf.cgi in @INC by kcott
in thread Can't locate conf.cgi in @INC by CarlosN

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.