And Dist::Zooky too!

Dist::Zilla is fantastic, but I seem to have quite a few distributions I wanted to convert and doing the boilerplate for dist.ini from an existing distribution can be a little tedious.

Wouldn't it be great if there was a tool to do this for me?

And so Dist::Zooky was born.

( Embarressingly I had to explain the reference to RJBS, who found this ).

Dist::Zooky generates a dist.ini for a distribution by examining the metadata produced by running Makefile.PL or Build.PL and then converting it to something that
Dist::Zilla will like.

For Build.PL and Module::Install based distributions it does this from the MYMETA.yml file that is produced by running the .PL file. For ExtUtils::MakeMaker based distributions it gathers the meta by parsing the Makefile that is generated. Ick.

Here's an example

$ cd Foo-Bar

$ ls -l

total 32

-r--r--r-- 1 chris users 20 Apr 1 2005 CHANGES

-rw-r--r-- 1 chris users 152 Apr 1 2005 MANIFEST

-rw-r--r-- 1 chris users 389 Jan 13 2008 META.yml

-r-xr-xr-x 1 chris users 297 Jun 24 14:41 Makefile.PL

-r--r--r-- 1 chris users 19 Apr 1 2005 README

drwxr-xr-x 2 chris users 512 Apr 1 2005 bin

drwxr-xr-x 3 chris users 512 Apr 1 2005 lib

-r--r--r-- 1 chris users 49 Apr 1 2005 test.pl

And Makefile.PL looks like this:

use ExtUtils::MakeMaker;

WriteMakefile(
NAME => 'Foo::Bar',
AUTHOR => 'Gobby Davro',
LICENSE => 'perl',
VERSION_FROM => 'lib/Foo/Bar.pm',
EXE_FILES => ['bin/foobar.pl'],
PREREQ_PM => { 'Some::Dependency' => '1.02' },
);

So we run dzooky the Dist::Zooky command-line tool:

$ dzooky Wrote 'dist.ini'

There are a number of files that should be removed now

Do you want me to remove [MANIFEST Makefile.PL] ? (yes/no) [no] yes
Removing files
Done.
$

And now we have a dist.ini file:

name = Foo-Bar version = 0.01 author = Gobby Davro license = Perl_5 copyright_holder = Gobby Davro

[GatherDir]
[PruneCruft]
[ManifestSkip]
[MetaYAML]
[MetaJSON]
[License]

;[Readme]

[ExecDir]


[ExtraTests]
[ShareDir]

[MakeMaker]

[Manifest]
[TestRelease]
[ConfirmRelease]
[UploadToCPAN]


;[Prereq / ConfigureRequires]
;[Prereq / BuildRequires]
[Prereq]
Some::Dependency = 1.02

Neat, huh.

Leave a comment

About bingos

user-pic System administrator, part-time Perl hacker, full-time POE [poe.perl.org] evangelist. One day he will be made to pay for his crimes. He has some modules on CPAN [cpan.org]. They may or may not be useful