Dist::Zilla Check License

Just a quickie post here at the Dist-Pen today!

One thing that has been pointed out to me in the past it that I neglected to includ a license file on some of my CPAN distros. I have even forgotten to include a copyright notice, not a mistake one should really be making.

Dist::Zilla already has a rule that compels me to add in a license, as we saw that in this post and I think with only a few quick changes to my '.ini' file I will be able to get the license file in there as well.

In my '.ini' I just enure I have the correct license set up, right now I have

license = Perl_5
I think I will change that over to the one on the more modern GPL licenses so all I need to go is search to see which ones are available from the CPAN page Software::License. I see that Software::License::GPL_3 is there so I am going to pick that one. Now the change to the '.ini'

–license = Perl_5
++license = GPL_3
and next add yet another plugin, this time the very aptly named Dist::Zilla::Plugin::License

Now after I run the 'dzil build' again if I check my 'Database-Accessor-0.01' folder I will see a 'LICENSE; file present. So a quick check of that new file I see;
This software is Copyright (c) 2018 by John Scoles.

This is free software, licensed under:

  The GNU General Public License, Version 3, June 2007

                    GNU GENERAL PUBLIC LICENSE
                       Version 3, 29 June 2007
So I get my GNU V 3 license and as a bonus my name is at the top of the file in the Copyright line. Also the plugin will get the latest version of the GPL_3 so I never have to bother to look for an update of that file for my distro I will always have the latest each time I build. Now if you ever run into the situation where the license you want to use in not on that list, you could, I suppose, add a new entry in CPAN under the 'Software::License' name-space. If you do not what to bother with that and happen to have the file handy the plugin will allow that. All you need to to is specify the file name like this

filename = d:/legal/docs/cheatum_&_steel/license.doc
and the plugin should put the file in your distro.



Thanks for this series. I am trying to learn mysteries of DZil myself, so this is an interesting read!

filename = d:/legal/docs/cheatum_&_steel/license.doc

This will prevent others who clone your repo from building the dist.

Please do not follow the methods in these blog posts of using Dist::Zilla, they are drawn out, incomplete, and in places counterproductive. Instead I would suggest starting with bundles like Dist::Zilla::PluginBundle::Starter or Dist::Milla, and if you need help, plenty of advice is available in #distzilla on irc.perl.org.

You are using a file from outside the repository to build the distribution. Nobody else has that file stored in that path on their computer, so nobody else can build the distribution. If that fact counts as undocumented on account of the documentation not mentioning that then even infinite documentation will be insufficient.

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