Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Perl Can';在@INC中找不到自定义模块_Perl_Perl Module - Fatal编程技术网

Perl Can';在@INC中找不到自定义模块

Perl Can';在@INC中找不到自定义模块,perl,perl-module,Perl,Perl Module,我有一个运行模块代码的基本Perl脚本。切换到新计算机后,我无法再运行此脚本。目录树的设置如下所示: SatanicBot src SatanicBot Bot.pm Utils.pm run.pl <-- The script that uses the module 运行run.pl时,出现以下错误: Can't locate SatanicBot/Bot.pm in @INC (you may need to install the Sata

我有一个运行模块代码的基本Perl脚本。切换到新计算机后,我无法再运行此脚本。目录树的设置如下所示:

SatanicBot
  src
    SatanicBot
      Bot.pm
      Utils.pm
  run.pl <-- The script that uses the module
运行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

@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

什么是
$FindBin::Bin/SatanicBot
?可能与应该链接到正确位置的
$FindBin::Bin/src/SatanicBot
不同,因为run.pl已经在src目录中。第二个表示Bot.pm在SatanicBot/src/src/SatanicBot中。提示:
lib
是包含模块的目录的常规名称,而不是
src
。(
bin
用于脚本)什么是
$FindBin::bin/SatanicBot
?可能与应该链接到正确位置的
$FindBin::Bin/src/SatanicBot
不同,因为run.pl已经在src目录中。第二个表示Bot.pm在SatanicBot/src/src/SatanicBot中。提示:
lib
是包含模块的目录的常规名称,而不是
src
。(
bin
对于脚本)尝试在原始计算机上执行“find/-name Bot.pm-print”以获取位置,然后查看是否将该文件、安装程序或相关文件组复制到您的路径中。这很有效,但我不知道为什么。模块文件不在/src中,它在/src/SatanicBot中,那么为什么它更喜欢/src呢?为了找到
Foo::Bar::Baz
,perl搜索
@INC
一个名为
Foo/Bar/Baz.pm
的文件,而不是一个名为
Baz.pm
的文件。谢谢尝试在原始计算机上执行“find/-name Bot.pm-print”以获取位置,然后查看是否将该文件、安装程序或相关文件组复制到您的路径中。这是可行的,但我仍在想为什么。模块文件不在/src中,它在/src/SatanicBot中,那么为什么它更喜欢/src呢?为了找到
Foo::Bar::Baz
,perl搜索
@INC
一个名为
Foo/Bar/Baz.pm
的文件,而不是一个名为
Baz.pm
的文件。谢谢