Perl:错误消息:在@INC中找不到... [英] Perl: error message: can´t locate ... in @INC

查看:249
本文介绍了Perl:错误消息:在@INC中找不到...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to compilate this scrip, but I have this message:


在@INC中找不到Email / Address.pm(@INC包含:C:/ strawberry / perl / lib C:/
Strawberry / perl / site / lib C:\strawberry\perl\vendor\lib。)at C:/ strawberry / perl /
lib / Regexp / Common / Email / Address.pm第9行。
BEGIN失败-编译在C:/ strawberry / perl / lib / Regexp / Common / Email /
Address.pm第9行。
在(eval 1)第1行的require中,编译失败。
BEGIN失败-在C:\examples\script2.pl第4行,编译中止。

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.

我不明白,因为我确实有这个根

I don´t understand because I really have this root


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

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

有人尝试编译时有人知道为什么出现此错误消息吗?我的股票?

非常感谢

我试图用这句话:


使用lib'C:/ strawberry / perl / lib / Regexp / Common / Email';

use lib 'C:/strawberry/perl/lib/Regexp/Common/Email';

并将这两个句子作为注释:

and putting as comment these two sentences:

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


全局符号%s需要显式的软件包名称
(F)您已经说过使用严格或使用严格vars,这表示所有变量必须在词法范围内(使用 my或 state),事先使用我们的声明或

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来使用软件包。

but I find it a little theoretical for me by I understand that you have to use packages by using the sentence 'use' at the begging of the code.

这是我的代码:

 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 :: Email :: Address 已安装。但是,您还需要 Email :: Address ,这是一个单独的模块。也就是说,您还应该在 C:/strawberry/perl/lib/Email/Address.pm 中安装一个模块。

I think the issue is, you do have Regexp::Common::Email::Address installed. However, you also need Email::Address, which is a separate module. That is to say, you should also have a module installed in C:/strawberry/perl/lib/Email/Address.pm.

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

Try using cpan to install Email::Address, see What's the easiest way to install a missing Perl module?

更新后会有更多解释:

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

Perl modules are organized in a hierarchical manner. The :: package separator is equal to a directory in your module library path. The full name/meaning of the module is derived from both the name of the package itself and the path in which it is installed. Suppose you had modules called Restaurant::Bill, Hat::Bill, and Names::Male::Bill. You would have three different files called Bill.pm, but they would represent very different concepts. They would be distinguished from each other by their paths in your module library.

这篇关于Perl:错误消息:在@INC中找不到...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆