Today I Learned: collection of notes, tips and tricks and stuff I learn from day to day working with computers and technology as a developer

View project on GitHub

Dist::Zilla and cpanfile

Dist::Zilla can work with a cpanfile as container for prerequisites.

This can be quite useful for interacting/integrating with other Perl toolchains elements like carton or carmel.

Dist::Zilla has a cpanfile consumer included in the distribution.

$ dzil build

Will generate a cpanfile based on the prerequisites listed in dist.ini using Dist::Zilla::Plugin::CPANFile.

For using cpanfile as the primary resource for prerequisites so you do not have to maintain the same information in several places you can use: Dist::Zilla::Plugin::Prereqs::FromCPANfile.

A nifty trick I used for generating a cpanfile for later use, since I want the cpanfile to be a the primary source for prerequisites is letting dzil generate the initial version.

Add the following line to your dist.ini



$ dzil build

Copy the cpanfile

$ cp <distribution build dir>/cpanfile .

Change the line in your dist.ini





And you are good to go.

Using the newly generated cpanfile, requires the installation of: Dist::Zilla::Plugin::Prereqs::FromCPANfile


You could also use the mymeta-cpanfile from Module-CPANfile

$ dzil build

$ cd <distribution build dir>

$ mymeta-cpanfile

Thanks @miyagawa