开发者

how to handle "unknown error" in perl module compilation

开发者 https://www.devze.com 2023-01-03 02:19 出处:网络
when I try to use a \"third part module\" 开发者_如何转开发in my perl script, I got some error message like

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"...

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. This bug was fixed nearly two years ago.


Two Tools that can be helpful here are

  • Carp::Always
  • Devel::SimpleTrace

:

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.

Sometimes it is helpful to run a syntax-only check on 'Foo'

perl -c path/to/Foo.pm
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号