http://www.perlmonks.org?node_id=397243


in reply to Require a script not found in @INC array

Try FindBin, it will create the absolute path to the directory where the script is run, and make it accessible in the variable $FindBin::Bin. Eg:

#! /usr/bin/perl use FindBin; use lib "$FindBin::Bin/../moduledir"; use My::Module; my $lister = My::Module->new(); . . .

Where moduledir is where I place my own code (big surprise :). This solved similar problems for me.

Hope this helps!

pernod
--
Mischief. Mayhem. Soap.

Replies are listed 'Best First'.
Re^2: Require a script not found in @INC array
by TJD (Initiate) on Oct 07, 2004 at 19:10 UTC
    I couldn't make this work, due to my own inadequacies as a Perl programmer, but it did get me to thinking. I went to the CGI Resource site and downloaded a freeware script called ServerCheck by Virtual Solutions. It showed me that the path I had been using was incorrect. Whether it was reported wrong, or I simply wrote it down wrong, is unknown, but as soon as I corrected it in Config.sys, the script worked. Thanks to everyone for their suggestions. You've saved my scalp once again. I was about to start pulling my hair out. :)