简体   繁体   English

如何在Perl模块编译中处理“未知错误”

[英]how to handle “unknown error” in perl module compilation

when I try to use a "third part module" in my perl script, I got some error message like "unknown error, compilation failed in require at ... line xxx" nothing else and the line mentioned in the error message is exact the same line I "use the module"... 当我尝试在我的Perl脚本中使用“第三方模块”时,我得到了一些错误消息,例如“未知错误,编译失败,要求在...行xxx” ,并且错误消息中提到的行与我在同一行“使用模块” ...

my question is: are there any good practice to handle this situation? 我的问题是:有什么好的做法可以处理这种情况? like a list to check or something else. 例如要检查的清单或其他内容。 thanks in advance. 提前致谢。

Upgrade to a newer version of Perl. 升级到更高版本的Perl。 This bug was fixed nearly two years ago. 该错误已在两年前修复。

Two Tools that can be helpful here are 这里有两个有用的工具是

:

perl -MCarp::Always myscript.pl 

This will hopefully emit a more comprehensive backtrace of what lead to the problem. 希望这将对导致问题的原因发出更全面的追溯。

Also important to note that 同样重要的是要注意

use Foo;

expands as 扩展为

BEGIN { require Foo; Foo->import }

so its possibly an indication there is a syntax error in 'Foo' and it needs to be looked into. 因此,它可能表示“ Foo”中存在语法错误,需要对其进行调查。

Sometimes it is helpful to run a syntax-only check on 'Foo' 有时在“ Foo”上运行仅语法检查会很有帮助

perl -c path/to/Foo.pm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM