7

I have read, at various times, both the documentation and a number of blog posts on Dist::Zilla. I have never felt confidence in my understanding of it.

In response to another question, @Ether raised the possibility of converting Crypt-SSLeay to use Dist::Zilla.

So, where can I find a concise guide showing me how to convert an existing CPAN module to use Dist::Zilla? Does the question even make sense?

Update:

The Makefile.PL for Crypt-SSLeay does a lot of work (a lot of it seems unnecessary and I am trying to prune it) to find platform specific include and lib directories, to deduce the version of OpenSSL on the machine where it is being installed. How can I include that functionality if I use Dist::Zilla?

rafl
  • 11,980
  • 2
  • 55
  • 77
Sinan Ünür
  • 116,958
  • 15
  • 196
  • 339
  • 4
    If you have a lot of Makefile.PL logic, it might be best to just keep that instead of using Dist::Zilla to generate it. You can use as much or as little of dzil as you like, and still do the other things manually as before. Considering that dzil isn't particularly good at building complex Makefile.PLs for you, I'd recommend you just stick with the Makefile.PL you already have, using dzil for all the rest. – rafl Oct 22 '10 at 21:07
  • Why do you want to convert to Dist::Zilla? I'm not saying you shouldn't, but if it's just for new and shiny, I'd say skip it. I like my simple Module::Release even if it isn't the new sexy. – brian d foy Oct 23 '10 at 00:31
  • 3
    Also, I recommend moving to Module::Build for complicated build systems. It's really easy to subclass and to add additional targets. A "show_libs" sorta target that tried to configure things without trying to build things could be a nice debugging step. Even a "mail_setup_to_developers" target could be nice :) – brian d foy Oct 23 '10 at 00:34
  • @brian I don't necessarily want to convert to `Dist::Zilla`. the suggestion came up elsewhere and I thought this might be a good opportunity for me to finally figure it out. On the other hand, your `Module::Build` suggestions are great. – Sinan Ünür Oct 23 '10 at 00:45
  • 1
    I'd say that you try Dist::Zilla on something else first so you can make a lot of mistakes where it doesn't matter. :) – brian d foy Oct 23 '10 at 02:53

2 Answers2

10

The Dist::Zilla Choose Your Own Tutorial has a page on Converting a Dist to Dist::Zilla. One thing it doesn't mention there is my VersionFromModule plugin, which is useful if you want to replicate the way many people use MakeMaker, with the distribution taking its version number from the main module. (Many people use dzil the other way, with the version in dist.ini and a plugin to stick it into the module, but either way works.)

If I need a more complex Makefile.PL than the one dzil generates, I switch to Module::Build and use my ModuleBuild::Custom plugin, which lets me write my own Build.PL and have dzil drop in metadata like the prerequisites.

The MakeMaker::Awesome plugin lets you do something similar with Makefile.PL, but it wasn't quite what I wanted. Instead, I wrote a MakeMaker::Custom plugin that works much like my ModuleBuild::Custom plugin. The big advantage of MakeMaker::Custom over MakeMaker::Awesome is that it makes it possible to build your dist for testing purposes without having to do dzil build. For an XS module that has to be rebuilt after every minor change, this is a big win.

cjm
  • 61,471
  • 9
  • 126
  • 175
8

These are the sites I have found the most helpful so far, as I'm in the middle of converting a CPAN distribution I comaintain to use it, as a learning exercise. I'm not there yet, but I haven't hit any super tricky bits so far!

Also, the #toolchain and #distzilla channels on irc.perl.org are full of helpful people, including the authors for Dist::Zilla and other related tools.

Ether
  • 53,118
  • 13
  • 86
  • 159