How can I add conditional prereqs to dist.ini
for each platform (Windows/Non windows) I want the module to support?
For example in perl code I could do:
if ( $^0 eq 'MSWin32' ){
require Win32::Foo;
}else{
require Bar::Baz;
}
How do I cater to each system/platform like this in dist.ini
so that the proper prereqs are installed via cpan/cpanm?
You can't do it in
dist.ini
, since an ini file doesn't really have any way to do conditional logic. But one way might be to write your own Dist::Zilla plugin, something like this:If you generalize this to take some platform-dependent lists of prereqs within
dist.ini
, it would make a good CPAN release.