在非标准位置安装 Perl 6 模块

Install Perl 6 modules in non standard location

使用 Rakudo Star 2016.01 产品安装 Perl 6 非常简单。我按照建议进行了手动安装 here:

perl Configure.pl --backend=moar --gen-moar --prefix=/opt/rakudo/rakudo-star-2016.01
make
make install

Perl6 现在安装在 /opt/rakudo/rakudo-star-2016.01/bin

Rakudo 随附的 Perl 6 模块管理器 Panda 安装在 /opt/rakudo/rakudo-star-2016.01/share/perl6/site/bin

然后我可以将这两个路径添加到 $PATH 变量中,以便立即 运行 安装 Perl6。

我唯一的问题是 Perl 6 模块的默认安装仍在 $HOME 目录中:~/.perl6

但是,我也想在 /opt 中安装 Perl 6 模块,实际上是在 /opt/perl/perl6

我尝试设置 PERL6LIB 变量,在 运行 上面的安装步骤之前,使用 export PERL6LIB=/opt/perl/perl6 但没有成功,因为模块仍然安装 ~/.perl6

如何让 Perl6 或 Panda 在 $HOME 目录之外的非标准位置安装模块?

设置 PERL6LIB 应该足以指定安装新 Perl 6 模块的路径。可以在安装 Perl 6 之前设置此变量。

export PERL6LIB="/opt/perl/perl6/lib" # or better is to put this line in .profile or .bash_profile
perl Configure.pl --backend=moar --gen-moar --prefix=/opt/rakudo-star/rakudo-star-2016.01
make && make install

这将在 /opt/rakudo-star/rakudo-star-2016.01/bin 中安装 perl6,在 /opt/rakudo-star/rakudo-star-2016.01/share/perl6/site/bin

中安装 panda

新模块可以用panda安装,例如

panda install Task::Star

它们应该在 /opt/perl/perl6/lib/.precomp 中找到(这是一个隐藏文件夹...)

在此安装过程中 ~/.perl6 仍会创建,但应该为空。