Mmm! Dist::Zilla Tea

Well today in the Dist-Pen I am going to get a little deeper into the basic plugins of Dist::Zilla.

I left off in my last post with Dist::Zilla I needed to add in an 'Abstract' to my dist.ini file and this I did ad first a pod entry


=Abstract: CRUD Interface for any DB

Unfortunately Dist::Zilla didn't like that so I should just did what it said first and add this into my Accessor.pm

package Database::Accessor;

# ABSTRACT: CRUD Interface for any DB

and

dzil build
[DZ] beginning to build Database-Accessor
[DZ] writing Database-Accessor in Database-Accessor-0.01
[DZ] building archive with Archive::Tar::Wrapper
[DZ] writing archive to Database-Accessor-0.01.tar.gz
[DZ] built in Database-Accessor-0.01

so what did I get? Looking at results in my working dir I did get

Database-Accessor-0.01.tar.gz

which is the tar-ball I would sent to PAUSE if it was ready to go. I also see I have a

Database-Accessor-0.01

dir witch is what is in the tar-ball or what in Dist::Zilla land is called the output dir. So this is doing the same sort of thing that 'make dist' does but without the bother of a Makefile.PL. Now if I could ever get it to install on windows I might be able to really package things up nice from there.

Now I would, of course, be sacrificed on the high alter of the Kwalitee gods if I let this go out. Lets remedy a few of this Kwalitee issues with a few simple Dist::Zilla plugins

You will remember my


[GatherDir]

from my last post this is just one of over 40+ plugins available for Dist::Zilla and maybe I should do a post on each that would keep me going till Easter thinks but that is for later. Right now I am going to have a look at an important ones that will give me the minimum for a CPAN distribution.

Well the majority of us like to be able to easily install a module and you can't do that without a Makefile of Build file so lets add a plugin to handle that for me. If I just add


[MakeMaker]
[ModuleBuild]

to my .ini file and then give dzil build another go you would see the same results as the first run. You will not see any changes in the present dir you are in, however if you look in Database-Accessor-0.01 dir you will now see

Build.PL dist.ini /lib Makefile.PL /t

so presto Dist::Zilla has done the work for me. A quick peek in Makefile.PL and I see that things look in order


my %WriteMakefileArgs = (
"ABSTRACT" => "CRUD Interface for any DB\r",
"AUTHOR" => "John Scoles",
"BUILD_REQUIRES" => {
"Module::Build" => "0.28"
},
"CONFIGURE_REQUIRES" => {
"ExtUtils::MakeMaker" => 0,
"Module::Build" => "0.28"
},
"DISTNAME" => "Database-Accessor",
"LICENSE" => "perl",
"NAME" => "Database::Accessor",
"PREREQ_PM" => {},
"VERSION" => "0.01",
"test" => {
"TESTS" => "t/*.t"
}
);


Most likely could not of done better myself as I know I have made a few goofs over the years with the good old copy and change and pray approach. I remember goofs such as forgetting to bump up version #, making a typeo in an requires and even misspelling my own name once. So as long as my .ini file is ok my Make and Build should be fine.

I did notice I got a '\r' on the end on of my 'ABSTACT' will have to see where that came from.

One other good little thing to know is


dzil clean

that gets rid of all the stuff you just created with the build, just like 'make clean'.

Finally for today one thing I like so far is that my working dir is separate from the output dir. Can't tell you the number of times when I had a brain cramp an accidentally deleted something from my disto I shouldn’t have, but then again I guess that is what a code repository is for.


haruo_nakajima_as_godzilla.jpg

Leave a comment

About byterock

user-pic Long time Perl guy, a few CPAN mods allot of work on DBD::Oracle and a few YAPC presentations