'Dist::Zilla' A Bath for Your Distro
So today in the Dist-pen I am going to add in a few more plugins into my Dist::Zilla just to see how bad my Kwalitee is.
One of the things that has always caused me problems when creating a perl module distribution are the 'required' modules that sometimes may be unknowingly buried in the code or just forgotten when the distro was created. My Database::Accessor package has a large number of required mods so I will have to be careful when creating my Dirstro
Just of the top of my head I have some ten or eleven in the Data::Accessor class and then there are my test cases where there are some more. Now with Dist::Zilla I can add a simple plugin and get most of them automajickaly so I added in
[AutoPrereqs]
Now this will not really work and not to bore you too much with miles of Dist::Zill poop coming onto your screen. So lets add these in as well
[Encoding]
encoding = bytes
The AutoPrereqs pluging should dig though you disto and find any prereq and the Encoding plugin will handle any files that might be in binary format. So I gave it a go and I get
beginning to build Database-Accessor
Could not decode UTF-8 t/t - Shortcut.lnk; filename set by GatherDir (Dist::Zilla::Plugin::GatherDir line 225); encoded_content added by GatherDir (Dist::Zilla::Plugin::GatherDir line 226); error was: utf8 "\xC0" does not map to Unicode at /usr/lib/perl/5.18/Encode.pm line 176.
...
Hmm not sure what 't - Shortcut.lnk' is most likely some junk that got in there when I mass copied my files over to my Ubuntu box so I just
rm t/'t - Shortcut.lnk'
and try again and it runs fine. With a quick peek in my Makefile.PL I see I have
…
"NAME" => "Database::Accessor",
"PREREQ_PM" => {
"Carp" => 0,
"Data::Dumper" => 0,
"File::Spec" => 0,
"Moose" => 0,
"Moose::Role" => 0,
"Moose::Util" => 0,
"Moose::Util::TypeConstraints" => 0,
"MooseX::AccessorsOnly" => 0,
"MooseX::Aliases" => 0,
"MooseX::AlwaysCoerce" => 0,
"MooseX::Constructor::AllErrors" => 0,
"MooseX::MetaDescription" => 0,
"constant" => 0,
"lib" => 0,
"strict" => 0,
"warnings" => 0
},
"TEST_REQUIRES" => {
"MooseX::Test::Role" => 0,
"Test::Deep" => 0,
"Test::Fatal" => 0,
"Test::More" => "0.82",
"Time::HiRes" => 0
},
…
and that is it.
No more culling though files by hand compiling a list of required modules. It also found a hidden file I had no idea was there 't – Shortcut.lnk'. By the way once I go rid of that file I was able to take out the 'Encoding' plugin and dist ran fine, but for now I will leave it in as it may find other files as time goes by.
Not only does this plugin do the base work for me I also points out that I have some modules that are present that may not be needed in the production version. I don't see any reason to have
- 'Data::Dumper' and
- 'Time::HiRes
and I do't even use
- Test::Fatal
This is a great way to clean up a distro apart from taking a bath.
I don't understand.
I don't understand this either.
I might guess what you're after when I see the next code block with "AutoPrereqs", though.
Why? This implies that AutoPrereqs doesn't work. Please tell your audience why.
You say later that this was only needed because of the leftover .lnk file. Can you explain why it is a good idea to leave this Encoding line as it is?
I think it can be valuable to write down step-by-step expierences with a module or tool, however, your series could benefit a lot from the following:
Egad even I do not understand
ordon't know what I was smoking yesterday must of posted the uncorrected version.
anyway I cleaned up that paragraph should be easer to read now
Btw there are more personal programming journals rather than than an instructional Blog.
Something to really motivate me to finish of the Data::Acessor project after 5 or 6 years of procratination.
Thanks