如何在没有 root 访问权限的情况下在本地安装 CPAN 模块(DynaLoader.pm 第 229 行错误)? [英] How can I install CPAN modules locally without root access (DynaLoader.pm line 229 error)?

查看:28
本文介绍了如何在没有 root 访问权限的情况下在本地安装 CPAN 模块(DynaLoader.pm 第 229 行错误)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不适用于其他模块,但举个例子.我使用 CPAN 设置安装了 Text::CSV_XS:

'makepl_arg' =>q[前缀=~/lib],

当我尝试运行 test.pl 脚本时:

<块引用>

$ perl test.pl

#!/usr/bin/perl使用 lib "/homes/foobar/lib/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi";使用文本::CSV_XS;打印测试";

我明白

<前>无法为模块 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"foob​​ar/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 失败——编译在 test.pl 第 6 行中止.

我将错误追溯到 DynaLoader.pm 它发生在这一行:

# 很多动态扩展加载问题会出现# 这一段代码:XYZ 在 DynaLoader.pm 的第 123 行失败.# 通常这些错误实际上发生在初始化中#扩展XS文件的C代码.Perl 报告错误为# 在这个 perl 代码中只是因为这是最后一个 perl 代码# 执行了.我的 $libref = dl_load_file($file, $module->dl_load_flags) 或croak("无法为模块$module加载'$file':".dl_error());

CSV_XS.so 存在于上述目录中

解决方案

我个人建议使用 本地::lib.:)

Doesn't work with other modules, but to give an example. I installed Text::CSV_XS with a CPAN setting:

'makepl_arg' => q[PREFIX=~/lib],

When I try running a test.pl script:

$ 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";

I get

Can't load '/homes/foobar/lib/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/Text/CSV_XS/CSV_XS.so' for module Text::CSV_XS: /homes/foobar/lib/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/Text/CSV_XS/CSV_XS.so: cannot open shared object file: No such file or directory at /www/common/perl/lib/5.8.2/i686-linux/DynaLoader.pm line 229.
at test.pl line 6
Compilation failed in require at test.pl line 6.
BEGIN failed--compilation aborted at test.pl line 6.

I traced the error back to DynaLoader.pm it happens at this line:

# 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 exists in the above directory

解决方案

Personally I would suggest to use local::lib. :)

这篇关于如何在没有 root 访问权限的情况下在本地安装 CPAN 模块(DynaLoader.pm 第 229 行错误)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆