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

Viewed 109

I'm working on a Perl Module which won't run on Windows, to prevent CPAN Testers failing it on Windows I want to use the meta files in the distribution generated from the Makefile to prevent the module from being installed or tested on Windows.

If the situation were the opposite (module only works on Windows) specifying a dependency on Win32 would make it installable on Windows only.

Also if the module is converted to Dist::Zilla, need a corresponding dist.ini solution.

2 Answers

The CPAN Testers FAQ says:

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

An alternative way would be to add a dependency on Platform::Unix or Platform::Windows.

This has the advantage that when your module is uploaded to CPAN, people will see "Platform::Whatever" in the dependencies, so it's immediately obvious what platform your module requires.

More information on Platform::*.

Related