在CentOS 7上安装Perl模块的问题

时间:2019-04-13 22:38:53

标签: perl

我一直在尝试在CentOS 7上安装一些Perl模块,并遇到很多问题。我尝试使用yum,cpan和cpanm(每当尝试其他方法时从头开始),它们似乎按照安装日志正确构建,但是当我使用“ use Module_Name”运行脚本时,它会返回依赖项已过时的问题版本。其中一个模块是Date :: Locale。另一个是URI :: Encode。是否有正确的方法在CentOS 7上安装Perl模块,而无需进行调整或手动干预?

池上要求对以下评论的输出:

/usr/bin/perl
/root/perl5/lib/perl5/5.16.3/x86_64-linux-thread-multi
/root/perl5/lib/perl5/5.16.3
/root/perl5/lib/perl5/x86_64-linux-thread-multi
/root/perl5/lib/perl5
/usr/local/lib64/perl5
/usr/local/share/perl5
/usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl
/usr/lib64/perl5
/usr/share/perl5

PERL5LIB: /root/perl5/lib/perl5
PERL_LOCAL_LIB_ROOT: /root/perl5
PERL_MB_OPT: --install_base "/root/perl5"
PERL_MM_OPT: INSTALL_BASE=/root/perl5
cpan is /root/perl5/bin/cpan
#!/usr/bin/perl
    make               [/usr/bin/make]
    make_arg           []
    make_install_arg   []
    make_install_make_command [/usr/bin/make]
    makepl_arg         []
    mbuild_arg         []
    mbuild_install_arg []
    mbuild_install_build_command [./Build]
    mbuildpl_arg       []
Loading internal logger. Log::Log4perl recommended for better logging
Reading '/root/.cpan/Metadata'
  Database was generated on Fri, 12 Apr 2019 17:29:03 GMT
Fetching with LWP:
http://CPAN.mirror.rafal.ca/authors/01mailrc.txt.gz
Reading '/root/.cpan/sources/authors/01mailrc.txt.gz'
............................................................................DONE
Fetching with LWP:
http://CPAN.mirror.rafal.ca/modules/02packages.details.txt.gz
Reading '/root/.cpan/sources/modules/02packages.details.txt.gz'
  Database was generated on Tue, 16 Apr 2019 03:17:02 GMT
............................................................................DONE
Fetching with LWP:
http://CPAN.mirror.rafal.ca/modules/03modlist.data.gz
Reading '/root/.cpan/sources/modules/03modlist.data.gz'
DONE
Writing /root/.cpan/Metadata
URI::Encode is up to date (1.1.1).

1 个答案:

答案 0 :(得分:0)

在Centos7上通过CPAN安装模块时,通常通过CPAN的自动配置将模块路径设置为use lib '/root/perl5/lib/perl5'

查找通过CPAN(find / -name module_name)安装的模块之一,并查看其路径。如果它在默认目录之外,则可以在脚本中添加此路径。