使用 Dist::Zilla 从 Perl 模块版本中排除一个目录

Exclude a directory from Perl module release using Dist::Zilla

我不想释放我的 Perl 模块根目录中的一个子目录。

我尝试使用 https://metacpan.org/pod/Dist::Zilla::Plugin::GatherDir

的 "prune_directory" 或 "exclude_file" 属性

我试图指定 [GatherDir] 部分,但这与 @Basic 重复,因此在我的 dist.ini 中我现在有(完整文件:https://github.com/telatin/FASTQ-Parser/blob/master/dist.ini):

[@Basic]
prune_directory = experimental

当使用 dzil build --verbose 构建时,我有所有的行:

[@Basic/GatherDir] adding file experimental/scripts/my.pl

所以我要修剪的目录确实添加了。

我该怎么办?

@Basic 插件包无法将选项传递给它使用的插件。因此,您必须首先使用 @Filter 捆绑包从中删除 GatherDir 插件,然后使用额外选项自己使用 GatherDir

[GatherDir]
prune_directory = experimental

[@Filter]
-bundle = @Basic
-remove = GatherDir

另一种选择是使用 @ConfigSlicer 包修改插件 @Basic 直接使用。

[@ConfigSlicer]
-bundle = @Basic
GatherDir.prune_directory[] = experimental

(本例中的[]是因为通过Config::Slicer设置multi-value选项需要指明是multi-value。详见the docs。 )

考虑 @Starter 包,这是 @Basic 的现代化版本,默认允许 -remove 和配置切片选项,以及基于现代 Dist::Zilla实践。