tags:

views:

55

answers:

2

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.

+4  A: 

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.

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

perl -c path/to/Foo.pm
Kent Fredric
+6  A: 

Upgrade to a newer version of Perl. This bug was fixed nearly two years ago.

jrockway
Thankfully it appears that this issue is only in 5.10.0 and not 5.10.1, so no one running any "reasonable" version these days should see it.
Ether