如何向 perl6 项目添加外部第三方依赖项?

How can I add an external, third-party dependency to a perl6 project?

要么我错过了它,要么没有关于该主题的明确信息。

  1. 我应该在哪里寻找 Perl 6 库? CPAN.org?或者只有 http://modules.perl6.org?

  2. 当我选择了一个后,如何将它添加到我的 Perl 6 项目中?

  3. 如果我在 GitHub 上找到它,我如何将它添加到我的 Perl 6 项目中?

请务必阅读@smonff 的回答以及对问题 2 和 3 的回答。

  1. Where should I look for perl 6 libraries?

modules.perl6.org.

  1. When I've chosen one, how can I add it to my perl 6 project?

使用 zef 在您的本地系统上安装它。

阅读 the modules doc page 以获取有关 use 在您的项目中创建模块的说明。

  1. If I find it [somewhere], how can I add it to my perl 6 project?

如果 zef 可以看到它(并且 zef 通常能够看到一个模块,如果它的 repo 列在 modules.perl6.org)那么 zef 应该可以安装它。如果没有,请联系作者或在#perl6 上询问。

作为第 2) 点和第 3) 点的答案,您可以查看 6pm. It's idea is to be NPM for Perl6。它也可以与 Perl5 的 Carton 进行比较。 6pmZef 上工作。

$ 6pm init

# Install dependencies to ./perl6-modules and add it to META6.json 
$ 6pm install Test::Meta --save

# Run a file using the local dependencies
$ 6pm exec-file test.p6

# Make your code always use 6pm by making it "use SixPM;"
$ perl6 test.p6

有关详细信息,请参阅 full documentation