It's easy to get the minimal pieces installed, so let's get to it.
Basic steps for building/using a Dist::Zilla based module from raw source:
- Check out module source
- install Dist::Zilla:
cpanm Dist::Zilla
- install author deps:
dzil authordeps | cpanm
- install module deps:
dzil listdeps | cpanm
- build module with dzil:
dzil build
1. Check out module source
For my example, I'm migrating my own App::PM::Website sources from an old laptop to a new one. Looking for example code to checkout? Try searching for dist.ini on github to find an interesting perl module. ;)
% git clone git@github.com:spazm/app-pm-website
% cd app-pm-website
Check the code out of the repository and cd into the top level.
2. Install Dist::Zilla
On this relatively clean perl 5.12.3 install,cpanm Dist::Zilla
brought in 81 packages.
% cpan Dist::Zilla
[andrew@fred]% cpanm Dist::Zilla 127 (git)-[dev] ~/src/app-pm-website--> Working on Dist::ZillaFetching http://search.cpan.org/CPAN/authors/id/R/RJ/RJBS/Dist-Zilla-4.300002.tar.gz ... OK
[... snip ...]
Building and testing Dist-Zilla-4.300002 ... OKSuccessfully installed Dist-Zilla-4.30000291 distributions installed
3. Install author dependencies
dzil authordeps
will show the modules necessary for Dist::Zilla to build the module from raw source into a built module. Pipe this to cpanm
to install the modules.
% dzil authordeps
Dist::Zilla::Plugin::MetaResources
Dist::Zilla::Plugin::AutoPrereqs
Dist::Zilla::Plugin::Repository
Dist::Zilla::Plugin::NextRelease
Dist::Zilla::PluginBundle::Basic
Dist::Zilla::Plugin::AutoVersion
Dist::Zilla::PluginBundle::Git
Dist::Zilla::Plugin::PkgVersion
Dist::Zilla::Plugin::MetaJSON
Dist::Zilla::Plugin::PodWeaver
% dzil authordeps | cpanm
Dist::Zilla::Plugin::MetaResources is up to date. (4.300002)
--> Working on Dist::Zilla::Plugin::Repository
[... snip ...]
Successfully installed Dist-Zilla-Plugin-PodWeaver-3.101641
11 distributions installed
4. Install module dependencies
Install the authordeps before module dependencies, in case authordeps are required for dzil to calculate the module dependencies. E.g. I needed PodWeaver installed via authordeps before I could rundzil listdeps
to see the module dependencies.
% dzil listdeps
App::Cmd
App::Cmd::Command
App::Cmd::Tester
base
Config::YAML
Data::Dumper
Date::Parse
DateTime
DateTime::Format::Strptime
ExtUtils::MakeMaker
HTTP::DAV
Net::Netrc
POSIX
strict
Template
Test::Class
Test::Class::Load
Test::More
warnings
% dzil listdeps | cpanm
App::Cmd is up to date. (0.312)
base is up to date. (2.15)
--> Working on Config::YAML
[...snip...]
Successfully installed Test-Class-0.36
Test::More is up to date. (0.98)
10 distributions installed
5. Build module
dzil build
will build the module into a directory and tar it up ready for cpan.
Similarly, dzil test
will build the code and run the tests, you'll use this to verify your changes to the target module.
And now I can get back to the task at hand, improving this module. I'll let you know how that goes too.
% dzil build
[DZ] beginning to build App-PM-Website
[DZ] guessing dist's main_module is lib/App/PM/Website.pm
[DZ] extracting distribution abstract from lib/App/PM/Website.pm
[DZ] writing App-PM-Website in App-PM-Website-0.112890
[DZ] building archive with Archive::Tar; install Archive::Tar::Wrapper for improved speed
[DZ] writing archive to App-PM-Website-0.112890.tar.gz
No comments:
Post a Comment