Makefile.PL meta.json OS 的先决条件,因此不会在 Windows 上安装模块

Makefile.PL meta.json prereqs for OS so module won't be installed on Windows

我正在开发一个不会在 Windows 上 运行 的 Perl 模块,以防止 CPAN 测试人员在 Windows 上使它失败 我想在从 Makefile 生成的分发,以防止在 Windows.

上安装或测试模块

如果情况相反(模块仅适用于 Windows),则指定对 Win32 的依赖将使它只能安装在 Windows 上。

另外如果模块转换为Dist::Zilla,需要相应的dist.ini解决方案。

CPAN Testers FAQ 说:

While it isn't a very elegant solution, the recommend approach is to either die in the Makefile.PL or Build.PL (or BAIL_OUT in a test file) with one of the following messages:

No support for OS

OS unsupported

另一种方法是添加对 Platform::Unix or Platform::Windows.

的依赖

这样做的好处是,当您的模块上传到 CPAN 时,人们会在依赖项中看到“Platform::Whatever”,因此您的模块需要什么平台是显而易见的。

More information on Platform::*.