无法在@INC 中找到自定义模块
Can't locate custom module in @INC
我有一个基本的 Perl 脚本,它是 运行 来自模块的代码。切换到新计算机后,我无法再 运行 此脚本。目录树设置如下:
SatanicBot
src
SatanicBot
Bot.pm
Utils.pm
run.pl <-- The script that uses the module
run.pl中的use语句是这样的:
use warnings;
use strict;
use diagnostics;
use Bot::BasicBot;
use Cwd qw(abs_path);
use FindBin;
use lib abs_path("$FindBin::Bin/SatanicBot");
# Without this, I get an error that is essentially caused by it not being to find the module.
use SatanicBot::Bot;
当我 运行 run.pl 时,出现以下错误:
Can't locate SatanicBot/Bot.pm in @INC (you may need to install the SatanicBot::Bot module) (@INC contains: /Users/elifoster/Desktop/Dev/SatanicBot/src/SatanicBot /Users/elifoster/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/darwin-2level /Users/elifoster/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0 /Users/elifoster/perl5/perlbrew/perls/perl-5.22.0/lib/5.22.0/darwin-2level /Users/elifoster/perl5/perlbrew/perls/perl-5.22.0/lib/5.22.0 .) at src/run.pl line 12.
如您所见,它指出@INC 包含 SatanicBot::Bot 模块所在的目录,但找不到它。我真的很困惑。
@INC
包含:
/Users/elifoster/Desktop/Dev/SatanicBot/src/SatanicBot
但是要在文件 /Users/elifoster/Desktop/Dev/SatanicBot/src/SatanicBot/Bot.pm
中找到 SatanicBot::Bot
包,您希望 @INC
包含
/Users/elifoster/Desktop/Dev/SatanicBot/src
我有一个基本的 Perl 脚本,它是 运行 来自模块的代码。切换到新计算机后,我无法再 运行 此脚本。目录树设置如下:
SatanicBot
src
SatanicBot
Bot.pm
Utils.pm
run.pl <-- The script that uses the module
run.pl中的use语句是这样的:
use warnings;
use strict;
use diagnostics;
use Bot::BasicBot;
use Cwd qw(abs_path);
use FindBin;
use lib abs_path("$FindBin::Bin/SatanicBot");
# Without this, I get an error that is essentially caused by it not being to find the module.
use SatanicBot::Bot;
当我 运行 run.pl 时,出现以下错误:
Can't locate SatanicBot/Bot.pm in @INC (you may need to install the SatanicBot::Bot module) (@INC contains: /Users/elifoster/Desktop/Dev/SatanicBot/src/SatanicBot /Users/elifoster/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/darwin-2level /Users/elifoster/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0 /Users/elifoster/perl5/perlbrew/perls/perl-5.22.0/lib/5.22.0/darwin-2level /Users/elifoster/perl5/perlbrew/perls/perl-5.22.0/lib/5.22.0 .) at src/run.pl line 12.
如您所见,它指出@INC 包含 SatanicBot::Bot 模块所在的目录,但找不到它。我真的很困惑。
@INC
包含:
/Users/elifoster/Desktop/Dev/SatanicBot/src/SatanicBot
但是要在文件 /Users/elifoster/Desktop/Dev/SatanicBot/src/SatanicBot/Bot.pm
中找到 SatanicBot::Bot
包,您希望 @INC
包含
/Users/elifoster/Desktop/Dev/SatanicBot/src