I am setting up perl site on XAMPP local server. I have placed the code at proper place and cha开发者_开发技巧nge first line of all .pl
and .cgi
files as per the path. i.e.
#!"D:\xampp\perl\bin\perl.exe"
for my case. Still I am getting error like
Can't locate inc/nph-globals.pl in @INC (@INC contains: D:/xampp/perl/site/lib/ D:/xampp/perl/lib D:/xampp/perl/site/lib . D:/xampp/apache) at D:/xampp/htdocs//cgi-bin/webscripts/nph-home.pl line 9.
Please suggest.
I suspect the file is located at
D:/xampp/htdocs/cgi-bin/webscripts/inc/nph-globals.pl
If so, it doesn't work because your script incorrectly assume the current working directory is set to the directory that contains the executing script, namely
D:/xampp/htdocs/cgi-bin/webscripts
The following code will address that issue:
use lib 'D:/xampp/htdocs/cgi-bin/webscripts';
Or generically,
use Cwd qw( realpath );
use File::Basename qw( dirname );
use lib dirname(realpath($0));
Looks to me that on the file that give this error, it cannot locate the file inc/nph-globals.pl. probably in that file, you need to specify something like
#!"D:\xampp\perl\bin\perl.exe" -I <path_to_inc_nph-globals.pl>
精彩评论