gpt4 book ai didi

raku - 请问@INC 的perl6 等价物是什么?

转载 作者:行者123 更新时间:2023-12-04 04:09:11 24 4
gpt4 key购买 nike

我去

export PERL6LIB="/GitHub/perl6-Units/lib"

进而
echo $PERL6LIB
/GitHub/perl6-Units/lib

但是当我运行 perl6 t/01-basic.t
use v6;

use Test;

plan 3;

lives-ok {
use Units <m>;
ok @Units::UNITS.elems > 0;
ok (0m).defined;
}

done-testing;

我仍然收到错误
===SORRY!===
Could not find Units at line 8 in:
/Users/--me--/.perl6
/usr/local/Cellar/rakudo-star/2018.01/share/perl6/site
/usr/local/Cellar/rakudo-star/2018.01/share/perl6/vendor
/usr/local/Cellar/rakudo-star/2018.01/share/perl6
CompUnit::Repository::AbsolutePath<140707489084448>
CompUnit::Repository::NQP<140707463117264>
CompUnit::Repository::Perl5<140707463117304>

在 Perl 5 中我会使用 print "@INC";查看在引发错误之前为 lib 搜索了哪些路径。使用 say flat $*REPO.repo-chain.map(*.loaded);要么在加载之前,要么在引发异常之后。

任何帮助将不胜感激 - 或者可能是关于在 ~/.perl6 中添加内容的提示因为我也无法使用符号链接(symbolic link)。

最佳答案

错误消息本身告诉您可用的库路径是什么。您无法打印它们,因为您希望在编译时错误之前发生运行时操作( say )——您可以打印出 $*REPO在编译时,但再次异常已经向您展示了您想要的内容。

$ PERL6LIB="/GitHub/perl6-Units/lib" perl6 -e 'BEGIN say $*REPO.repo-chain; use Foo;'
(file#/GitHub/perl6-Units/lib inst#/Users/ugexe/.perl6 inst#/Users/ugexe/.rakudobrew/moar-2018.08/install/share/perl6/site inst#/Users/ugexe/.rakudobrew/moar-2018.08/install/share/perl6/vendor inst#/Users/ugexe/.rakudobrew/moar-2018.08/install/share/perl6 ap# nqp# perl5#)
===SORRY!===
Could not find Foo at line 1 in:
/GitHub/perl6-Units/lib
/Users/ugexe/.perl6
/Users/ugexe/.rakudobrew/moar-2018.08/install/share/perl6/site
/Users/ugexe/.rakudobrew/moar-2018.08/install/share/perl6/vendor
/Users/ugexe/.rakudobrew/moar-2018.08/install/share/perl6
CompUnit::Repository::AbsolutePath<140337382425072>
CompUnit::Repository::NQP<140337350057496>
CompUnit::Repository::Perl5<140337350057536>

你可以看到 /GitHub/perl6-Units/lib显示在可用路径中,这与您的示例不同。我会质疑您的 shell/env 是否实际设置正确。

关于raku - 请问@INC 的perl6 等价物是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52301202/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com