Perl

如何在 Perl 中修改 @INC

  • May 9, 2016

我正在嘗試從原始碼安裝 Perl(因為我的伺服器沒有連接到 Internet),並且在執行“make install”時 .. 它停在:

Can't locate DWIM.pm in @INC (you may need to install the DWIM module) (@INC contains: lib dist/Exporter/lib .).
BEGIN failed--compilation aborted.

注意:我之前安裝了 DWIM perl。

現在當我做

[root@ctl perl-5.22.2]# perl -e "print \"@INC\""
/opt/dwimperl-linux-5.20.1-10-x86_64/perl/lib/site_perl/5.20.1/x86_64-linux /opt/dwimperl-linux-5.20.1-10-x86_64/perl/lib/site_perl/5.20.1 /opt/dwimperl-linux-5.20.1-10-x86_64/perl/lib/5.20.1/x86_64-linux /opt/dwimperl-linux-5.20.1-10-x86_64/perl/lib/5.20.1

DWIM 文件位於

[root@ctl perl-5.22.2]# find / -name DWIM.pm
/opt/dwimperl-linux-5.20.1-10-x86_64/perl/lib/site_perl/5.20.1/DWIM.pm

我想要的是如何在 perl 中修改 @INC 以便它找到 DWIM.pm ?

您可以通過將其路徑添加到 PERL5LIB 環境變數來實現:

export PERL5LIB=/opt/dwimperl-linux-5.20.1-10-x86_64/perl/lib/site_perl/5.20.1

引用自:https://unix.stackexchange.com/questions/282107