gpt4 book ai didi

Perl: 错误信息: can´t locate ... in @INC

转载 作者:行者123 更新时间:2023-12-04 17:30:18 26 4
gpt4 key购买 nike

我正在尝试编译 this scrip ,但我有这个消息:

Can't locate Email/Address.pm in @INC (@INC contains: C:/strawberry/perl/lib C:/ strawberry/perl/site/lib C:\strawberry\perl\vendor\lib .) 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:\examples\script2.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:\examples\script2.pl lin
e 10.Execution of C:\examples\script2.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 模块以分层方式组织。 ::包分隔符等于模块库路径中的目录。模块的全名/含义来源于包本身的名称和它的安装路径。假设您有名为 Restaurant::Bill 的模块, Hat::Bill , 和 Names::Male::Bill .您将拥有三个名为 Bill.pm 的不同文件。 ,但它们将代表非常不同的概念。它们将通过它们在模块库中的路径相互区分。

关于Perl: 错误信息: can´t locate ... in @INC,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11983041/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com