perl - 使用 Dist::Zilla dist.ini 如何获得仅用于测试的文件?

标签 perl cpan dist-zilla

在基于 Dist::Zilla 的发行版中,我想要一些仅用于测试但不安装的文件。这些是运行时不需要的模型库。

我该怎么做?

最佳答案

CPAN 发行版从不安装 txt 目录。您可以将测试和模拟库放入 t

以我的模块 MooseX::LocalAttribute 为例. In the dist ,有一个t/、一个t/lib和一个xt/

如果您使用 cpanm -l 将它安装到本地 lib 目录中,您将看到没有安装任何测试。这会自动发生。这就是 CPAN 的工作原理。

$ cpanm -l mylib MooseX::LocalAttribute
--> Working on MooseX::LocalAttribute
Fetching http://www.cpan.org/authors/id/S/SI/SIMBABQUE/MooseX-LocalAttribute-0.05.tar.gz ... OK
Configuring MooseX-LocalAttribute-0.05 ... OK
Building and testing MooseX-LocalAttribute-0.05 ... OK
Successfully installed MooseX-LocalAttribute-0.05
1 distribution installed

$ tree mylib
mylib
├── lib
│   └── perl5
│       ├── MooseX
│       │   └── LocalAttribute.pm
│       └── x86_64-linux
│           ├── auto
│           │   └── MooseX
│           │       └── LocalAttribute
│           └── perllocal.pod
└── man
    └── man3
        └── MooseX::LocalAttribute.3

9 directories, 3 files

请注意,只要东西在 t/lib 中(或者实际上在 t/ 下的任何位置),您就不必在 PAUSE 中隐藏包名称索引器。它足够聪明,找不到它。

关于perl - 使用 Dist::Zilla dist.ini 如何获得仅用于测试的文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73602019/

相关文章:

perl - 在 AWK 中调用 Perl 脚本

Perl:与 'ssh -q' 的 rsync 失败,退出代码为 14

perl - 如何使用 Perl 6 中的 Perl 5 模块?

perl - cpan 忽略 makepl_arg 和 mbuild_arg

linux - 移动文件的脚本在 Perl 中不起作用

perl - 按值和键对哈希进行排序(按顺序)

perl - 当 SQLite 索引失败时如何修复 cpan 命令?

perl - 为 Dist::Zilla 类型转换模块编写测试

perl - 如何测试输出/修改文件的模块/脚本?

perl - 我可以让 dist-zilla 填写模板文件中的任意字段吗?