Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/10.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´;找不到。。。in@INC_Perl_Compiler Errors - Fatal编程技术网

Perl:错误消息:can´;找不到。。。in@INC

Perl:错误消息:can´;找不到。。。in@INC,perl,compiler-errors,Perl,Compiler Errors,我正在尝试编译,但我收到以下消息: 在@INC中找不到Email/Address.pm(@INC包含:C:/草莓/perl/lib C:/ 草莓/perl/site/lib C:\草莓\perl\vendor\lib。)在C:/草莓/perl/ lib/Regexp/Common/Email/Address.pm第9行。 BEGIN失败--编译在C:/草莓/perl/lib/Regexp/Common/Email处中止/ 地址:下午4时9分。 在(eval 1)第1行的require中编译失败。

我正在尝试编译,但我收到以下消息:

在@INC中找不到Email/Address.pm(@INC包含:C:/草莓/perl/lib C:/ 草莓/perl/site/lib C:\草莓\perl\vendor\lib。)在C:/草莓/perl/ lib/Regexp/Common/Email/Address.pm第9行。 BEGIN失败--编译在C:/草莓/perl/lib/Regexp/Common/Email处中止/ 地址:下午4时9分。 在(eval 1)第1行的require中编译失败。 BEGIN失败--编译在C:\examples\script2.pl第4行中止

我不明白,因为我真的有这个根

C:/草莓/perl/lib/Regexp/Common/Email/Address.pm

有人知道我试图编译纸条时为什么会出现此错误消息吗?

多谢各位


我试着用这句话:

使用lib'C:/草莓/perl/lib/Regexp/Common/Email'

并将以下两句话作为评论:

use Regexp::Common qw[Email::Address];
  use Email::Address
然后我得到了这个错误

Global symbol "%RE" requires explicit package name at C:\examples\script2.pl lin
e 10.Execution of C:\examples\script2.pl aborted due to compilation errors.
我已经看过了

全局符号“%s”需要显式的包名 (F) 您已经说过“use strict”或“use strict vars”,这表示所有变量必须是词汇范围(使用“my”或“state”)、预先使用“our”声明,或者明确限定全局变量位于哪个包中(使用“:”)

但我觉得这对我来说有点理论性,因为我知道你必须在代码乞求时使用“use”这句话来使用包

顺便说一下,这是我的代码:

 use Regexp::Common qw[Email::Address];
  use Email::Address;
  while (<>) {
  my (@found) = /($RE{Email}{Address})/g;
  my (@addrs) = map $_->address, Email::Address->parse("@found");
  print "X-Addresses: ", join(", ", @addrs), "\n";
  }
使用Regexp::Common qw[Email::Address];
使用电子邮件::地址;
而(){
我的(@found)=/($RE{Email}{Address})/g;
我的(@addrs)=映射$->地址,电子邮件::地址->解析(@found”);
打印“X地址:”,加入(“,”,@addrs),“\n”;
}

我得到了这个代码

我想问题是,你确实安装了。但是,您还需要一个单独的模块。也就是说,您还应该在
C:/草莓/perl/lib/Email/Address.pm
中安装一个模块

尝试使用cpan安装
Email::Address
,请参阅


更新时请提供更多解释:

Perl模块以分层方式组织。包分隔符等于模块库路径中的目录。模块的全名/含义来源于包本身的名称及其安装路径。假设您有名为
Restaurant::Bill
Hat::Bill
Names::Male::Bill
的模块。您将有三个不同的文件,名为
Bill.pm
,但它们代表的概念非常不同。它们将通过在模块库中的路径相互区分