不适用于其他模块,但举个例子。我使用 CPAN 设置安装了 Text::CSV_XS:
'makepl_arg' => q[PREFIX=~/lib],
当我尝试运行 test.pl 脚本时:
$ perl test.pl
#!/usr/bin/perl
use lib "/homes/foobar/lib/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi";
use Text::CSV_XS;
print "test";
我明白了
无法为模块 Text::CSV_XS: /homes/ 加载 '/homes/foobar/lib/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/Text/CSV_XS/CSV_XS.so' foobar/lib/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/Text/CSV_XS/CSV_XS.so:无法打开共享对象文件:/www/common/perl 中没有这样的文件或目录/lib/5.8.2/i686-linux/DynaLoader.pm 第 229 行。 在 test.pl 第 6 行 在 test.pl 第 6 行的 require 编译失败。 BEGIN failed——编译在 test.pl 第 6 行中止。
我将错误追溯到 DynaLoader.pm 它发生在这一行:
# Many dynamic extension loading problems will appear to come from
# this section of code: XYZ failed at line 123 of DynaLoader.pm.
# Often these errors are actually occurring in the initialisation
# C code of the extension XS file. Perl reports the error as being
# in this perl code simply because this was the last perl code
# it executed.
my $libref = dl_load_file($file, $module->dl_load_flags) or
croak("Can't load '$file' for module $module: ".dl_error());
CSV_XS.so 存在于上述目录中