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
精彩评论