'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.

doodle__10_bath_time_for_godzilla__by_lifeiscutebyadeline-d940sfp.jpg

2 Comments

One of the things that has always caused me problems when installing perl mosuela

I don't understand.

here the sometimes many 'required' modules that might be buried in the code or forgotten when the packages was created. In my Database::Accessor package has a large number of required mods my module will need to work.

I don't understand this either.

I might guess what you're after when I see the next code block with "AutoPrereqs", though.

Now this will not really work

Why? This implies that AutoPrereqs doesn't work. Please tell your audience why.

encoding = bytes

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:

  • Make it more concise. Don't post every day, but summarize a problem from several days into one post, without leaving the audience left with something not working like you did in https://blogs.perl.org/users/byterock/2018/02/no-moose-zillasuch.html
  • You seem to have spelling problems, and while that shouldn't prevent someone from posting articles, it would be very helpful if you could get someone have a look over it before posting
  • Make less postings and link to the previous postings; add a table of contents somewhere to make people able to navigate through your series.

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