Subject: | Implement a sugary PP config format |
Currently dist.ini is the main supported format, it forces you to
shoehorn all your arguments into a key-value namespace and doesn't allow
you to execute any Perl code.
As a result any dist that does something out of the ordinary (like XS
dists) have to write their own plugins to emit a custom Makefile.PL at
this point (see my OverridableMakeMaker for an example).
It would be nice if there was a way to write a dist.pl in a way that
wasn't ugly (and documented!). Attached is an example of how this might
look like. The example assumes that Dist::Zilla::Magic is implementing
an end-of-scope hook that returns the data being fed into it as a
HashRef.
Furthermore: As long as dist.ini is the default config format plugin
authors will be forced to shoehorn everything into a key-value namespace
1-level deep if they want to be compatible with most DZ dists.
This has irked my more than anything else about DZ. I think it would be
nice to have a pure-Perl config format as the default. That would make
the easy things easy and the hard things possible.
Subject: | dist.pl |
use Dist::Zilla::Magic;
conf name => 'Hailo';
conf author => 'Hinrik Ãrn Sigurðsson <hinrik.sig@gmail.com>';
conf author => 'Ãvar Arnfjörð Bjarmason <avar@cpan.org>';
conf copyright_holder => 'Hinrik Ãrn Sigurðsson and Ãvar Arnfjörð Bjarmason';
conf license => 'Perl_5';
conf_plugin '@AVAR' => {
dist => 'Hailo',
bugtracker => 'rt',
github_user => 'hailo',
no_AutoPrereq => 1,
no_MakeMaker => 1,
};
our @DIR = qw(libutf libfmt libregexp);
our @OBJ = map { s/\.c$/.o/; $_ }
grep { ! /test/ }
glob "lib*/*.c";
conf_plugin OverridableMakeMaker => {
# Here be XS
-extra_args => {
DIR => [ @DIR ],
INC => join(' ', map { "-I$_" } @DIR),
# This used to be '-shared lib*/*.o' but that doesn't work on Win32
LDDLFLAGS => "-shared @OBJ",
},
};
conf_plugin '=inc::Dist::Zilla::Plugin::HailoMakeMaker / HailoMakeMaker';
conf_plugin 'Prereq' => {
perl => 5.010,
Time::HiRes => 0,
File::Spec::Functions => 0,
## Depend on Mouse and Moose, we can use either one
# Mouse
Mouse => 0.50,
MouseX::Types => 0.05,
MouseX::Getopt => 0.2601,
# Moose
Moose => 0.94,
MooseX::Types => 0.21,
MooseX::StrictConstructor => 0.08,
MooseX::Getopt => 0.26,
# Hailo.pm
Any::Moose => 0.11,
autodie => 2.08,
File::CountLines => 0.0.2,
IO::Interactive => 0.0.6,
# Command.pm
Getopt::Long::Descriptive => 0.083,
Dir::Self => 0.10,
# ReadLine.pm
Term::ProgressBar => 2.00,
Term::ReadLine => 0,
# DBD.pm
List::MoreUtils => 0.22,
# SQLite.pm
DBD::SQLite => 1.29,
# everywhere
namespace::clean => 0.13,
## Pg/mysql: optional backends
#DBD::mysql => 4.013,
#DBD::Pg => 2.16.1,
## Test-requires
File::Slurp => 9999.13,
Test::Exception => 0.29,
Test::More => 0.94,
Test::Output => 0.16,
Test::Script => 1.07,
Test::Expect => 0.30,
Test::Script::Run => 0.03,
Test::Synopsis => 0.06,
Data::Section => 0.100770,
};