Monday, 15 June 2015

windows - Perl module - dist.ini and platform specific prereqs -



windows - Perl module - dist.ini and platform specific prereqs -

how can add together conditional prereqs dist.ini each platform (windows/non windows) want module support?

for illustration in perl code do:

if ( $^0 eq 'mswin32' ){ require win32::foo; }else{ require bar::baz; }

how cater each system/platform in dist.ini proper prereqs installed via cpan/cpanm?

you can't in dist.ini, since ini file doesn't have way conditional logic. 1 way might write own dist::zilla plugin, this:

package dist::zilla::plugin::myprereqs; # pick improve name utilize moose; 'dist::zilla::role::prereqsource'; sub register_prereqs { $self = shift; %prereqs; if ( $^0 eq 'mswin32' ) { $prereqs{'win32::foo'} = '0.12'; # min. version } else { $prereqs{'bar::baz'} = '1.43'; } $self->zilla->register_prereqs( %prereqs ); }

if generalize take platform-dependent lists of prereqs within dist.ini, create cpan release.

windows perl perl-module dist-zilla

No comments:

Post a Comment