加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

Perl:错误消息:无法在@INC中找到…

发布时间:2020-12-15 21:32:58 所属栏目:大数据 来源:网络整理
导读:我正在尝试编译 this scrip,但我有这样的信息: Can’t locate Email/Address.pm in @INC (@INC contains: C:/strawberry/perl/lib C:/ strawberry/perl/site/lib C:strawberryperlvendorlib .) at C:/strawberry/perl/ lib/Regexp/Common/Email/Address
我正在尝试编译 this scrip,但我有这样的信息:

Can’t locate Email/Address.pm in @INC (@INC contains: C:/strawberry/perl/lib C:/
strawberry/perl/site/lib C:strawberryperlvendorlib .) at C:/strawberry/perl/
lib/Regexp/Common/Email/Address.pm line 9.
BEGIN failed–compilation aborted at C:/strawberry/perl/lib/Regexp/Common/Email/
Address.pm line 9.
Compilation failed in require at (eval 1) line 1.
BEGIN failed–compilation aborted at C:examplesscript2.pl line 4.

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

C:/strawberry/perl/lib/Regexp/Common/Email/Address.pm

有人在我尝试编写我的脚本时知道为什么会出现此错误消息吗?

非常感谢

我试着用这句话:

use lib ‘C:/strawberry/perl/lib/Regexp/Common/Email’;

并将这两句话作为评论:

use Regexp::Common qw[Email::Address];
  use Email::Address

然后我收到这个错误

Global symbol "%RE" requires explicit package name at C:examplesscript2.pl lin
e 10.Execution of C:examplesscript2.pl aborted due to compilation errors.

我看过perldiag

Global symbol “%s” requires explicit package name
(F) You’ve said “use strict” or “use strict vars”,which indicates that all variables must either be lexically scoped (using “my” or “state”),declared beforehand using “our”,or explicitly qualified to say which package the global variable is in (using “::”).

但我发现它对我来说有点理论上我明白你必须在代码的乞讨时使用句子’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";
  }

我收到此代码from a question I asked before.

解决方法

我认为问题是,你确实安装了 Regexp::Common::Email::Address.但是,您还需要 Email::Address,这是一个单独的模块.也就是说,您还应该在C:/strawberry/perl/lib/Email/Address.pm中安装一个模块.

尝试使用cpan安装Email :: Address,请参阅What’s the easiest way to install a missing Perl module?

更新一点解释:

Perl模块以分层方式组织. :: package分隔符等于模块库路径中的目录.模块的全名/含义源自包本身的名称和安装它的路径.假设您有名为Restaurant :: Bill,Hat :: Bill和Names :: Male :: Bill的模块.你会有三个不同的文件叫做Bill.pm,但它们代表了截然不同的概念.它们将通过模块库中的路径彼此区分.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读