Dist::Zilla is a tool for simplifying the process of authoring and maintaining CPAN distributions. It allows authors to replace complex Makefiles and configuration files with a simple dist.ini file. This file defines the files and metadata needed for the distribution. Dist::Zilla handles common tasks like testing, documentation generation and releases through a simple CLI interface. It aims to reduce the overhead of distribution authoring so authors can focus on writing code.
6. ~/code/YourApp$ find .
./Changes
./LICENSE
./MANIFEST.SKIP
./Makefile.PL
./README
./lib/YourApp.pm
./lib/YourApp/Reticulator.pm
./lib/YourApp/Util/mtfnpy.pm
./lib/YourApp/Xyzzy.pm
./t/unit-tests.t
./t/pod-coverage.t
./t/pod.t
this is all the crap in your working copy where you write this dist
making all these is a boring pain in the ass
29. ~/code/YourApp$ find .
./Changes
./LICENSE
./MANIFEST.SKIP
./Makefile.PL
./README
./lib/YourApp.pm
./lib/YourApp/Reticulator.pm
./lib/YourApp/Util/mtfnpy.pm
./lib/YourApp/Xyzzy.pm
./t/unit-tests.t
./t/pod-coverage.t
./t/pod.t
So, back to this list of files....
30. ~/code/YourApp$ find .
./lib/YourApp.pm
./lib/YourApp/Reticulator.pm
./lib/YourApp/Util/mtfnpy.pm
./lib/YourApp/Xyzzy.pm
./t/unit-tests.t
Let’s get rid of all the crap
31. ~/code/YourApp$ find .
dist.conf
./lib/YourApp.pm
./lib/YourApp/Reticulator.pm
./lib/YourApp/Util/mtfnpy.pm
./lib/YourApp/Xyzzy.pm
./t/unit-tests.t
and replace it with a little config for Dist::Zilla
32. package YourApp;
=head1 NAME
YourApp - my awesome app
=head1 VERSION
version 1.001
=cut
our $VERSION = 0.001;
=head1 DESCRIPTION
This app is awesome.
=head1 METHODS
=head2 this_method
This method does stuff.
=cut
method this_method { ... }
=head2 that_method
Also stuff.
method that_method { ... }
=head1 AUTHOR
Margo Yapp <myapp@example.com>
=head1 LICENSE
Copyright (C) 2008, Margo Yapp.
This is distributed under the terms of the accidental death and
dismemberment license and if you redistribuet this document you
will be “accidentally” deathed or dismembered. You have been
told.
=cut
1;
Here’s a .pm file
33. package YourApp;
=head1 NAME
YourApp - my awesome app
=head1 VERSION
version 1.001
=cut
our $VERSION = 0.001;
=head1 DESCRIPTION
This app is awesome.
=head1 METHODS
=head2 this_method
This method does stuff.
=cut
method this_method { ... }
=head2 that_method
Also stuff.
method that_method { ... }
=head1 AUTHOR
Margo Yapp <myapp@example.com>
=head1 LICENSE
Copyright (C) 2008, Margo Yapp.
This is distributed under the terms of the accidental death and
dismemberment license and if you redistribuet this document you
will be “accidentally” deathed or dismembered. You have been
told.
=cut
1;
The =name section is annoying.
34. package YourApp;
# ABSTRACT: my awesome app
=head1 VERSION
version 1.001
=cut
our $VERSION = 0.001;
=head1 DESCRIPTION
This app is awesome.
=head1 METHODS
=head2 this_method
This method does stuff.
=cut
method this_method { ... }
=head2 that_method
Also stuff.
method that_method { ... }
=head1 AUTHOR
Margo Yapp <myapp@example.com>
=head1 LICENSE
Copyright (C) 2008, Margo Yapp.
This is distributed under the terms of the accidental death and
dismemberment license and if you redistribuet this document you
will be “accidentally” deathed or dismembered. You have been
told.
=cut
1;
We’ll replace it with a comment.
35. package YourApp;
# ABSTRACT: my awesome app
=head1 VERSION
version 1.001
=cut
our $VERSION = 0.001;
=head1 DESCRIPTION
This app is awesome.
=head1 METHODS
=head2 this_method
This method does stuff.
=cut
method this_method { ... }
=head2 that_method
Also stuff.
method that_method { ... }
=head1 AUTHOR
Margo Yapp <myapp@example.com>
=head1 LICENSE
Copyright (C) 2008, Margo Yapp.
This is distributed under the terms of the accidental death and
dismemberment license and if you redistribuet this document you
will be “accidentally” deathed or dismembered. You have been
told.
=cut
1;
The =version section is redundant.
36. package YourApp;
# ABSTRACT: my awesome app
our $VERSION = 0.001;
=head1 DESCRIPTION
This app is awesome.
=head1 METHODS
=head2 this_method
This method does stuff.
=cut
method this_method { ... }
=head2 that_method
Also stuff.
method that_method { ... }
=head1 AUTHOR
Margo Yapp <myapp@example.com>
=head1 LICENSE
Copyright (C) 2008, Margo Yapp.
This is distributed under the terms of the accidental death and
dismemberment license and if you redistribuet this document you
will be “accidentally” deathed or dismembered. You have been
told.
=cut
1;
Drop it.
37. package YourApp;
# ABSTRACT: my awesome app
our $VERSION = 0.001;
=head1 DESCRIPTION
This app is awesome.
=head1 METHODS
=head2 this_method
This method does stuff.
=cut
method this_method { ... }
=head2 that_method
Also stuff.
method that_method { ... }
=head1 AUTHOR
Margo Yapp <myapp@example.com>
=head1 LICENSE
Copyright (C) 2008, Margo Yapp.
This is distributed under the terms of the accidental death and
dismemberment license and if you redistribuet this document you
will be “accidentally” deathed or dismembered. You have been
told.
=cut
1;
Even the $VERSION is redundant, since we want it constant across the dist.
38. package YourApp;
# ABSTRACT: my awesome app
=head1 DESCRIPTION
This app is awesome.
=head1 METHODS
=head2 this_method
This method does stuff.
=cut
method this_method { ... }
=head2 that_method
Also stuff.
method that_method { ... }
=head1 AUTHOR
Margo Yapp <myapp@example.com>
=head1 LICENSE
Copyright (C) 2008, Margo Yapp.
This is distributed under the terms of the accidental death and
dismemberment license and if you redistribuet this document you
will be “accidentally” deathed or dismembered. You have been
told.
=cut
1;
our overarching METHOD section is dumb
39. package YourApp;
# ABSTRACT: my awesome app
=head1 DESCRIPTION
This app is awesome.
=method this_method
This method does stuff.
=cut
method this_method { ... }
=method that_method
Also stuff.
method that_method { ... }
=head1 AUTHOR
Margo Yapp <myapp@example.com>
=head1 LICENSE
Copyright (C) 2008, Margo Yapp.
This is distributed under the terms of the accidental death and
dismemberment license and if you redistribuet this document you
will be “accidentally” deathed or dismembered. You have been
told.
=cut
1;
let’s just use =method for them all
40. package YourApp;
# ABSTRACT: my awesome app
=head1 DESCRIPTION
This app is awesome.
=method this_method
This method does stuff.
=cut
method this_method { ... }
=method that_method
Also stuff.
method that_method { ... }
=head1 AUTHOR
Margo Yapp <myapp@example.com>
=head1 LICENSE
Copyright (C) 2008, Margo Yapp.
This is distributed under the terms of the accidental death and
dismemberment license and if you redistribuet this document you
will be “accidentally” deathed or dismembered. You have been
told.
=cut
1;
Repeating the author everywhere is annoying, too.
41. package YourApp;
# ABSTRACT: my awesome app
=head1 DESCRIPTION
This app is awesome.
=method this_method
This method does stuff.
=cut
method this_method { ... }
=method that_method
Also stuff.
method that_method { ... }
=head1 LICENSE
Copyright (C) 2008, Margo Yapp.
This is distributed under the terms of the accidental death and
dismemberment license and if you redistribuet this document you
will be “accidentally” deathed or dismembered. You have been
told.
=cut
1;
Drop it, use author info found in DZ config.
42. package YourApp;
# ABSTRACT: my awesome app
=head1 DESCRIPTION
This app is awesome.
=method this_method
This method does stuff.
=cut
method this_method { ... }
=method that_method
Also stuff.
method that_method { ... }
=head1 LICENSE
Copyright (C) 2008, Margo Yapp.
This is distributed under the terms of the accidental death and
dismemberment license and if you redistribuet this document you
will be “accidentally” deathed or dismembered. You have been
told.
=cut
1;
The license is gigantic! Ugh!
43. package YourApp;
# ABSTRACT: my awesome app
=head1 DESCRIPTION
This app is awesome.
=method this_method
This method does stuff.
=cut
method this_method { ... }
=method that_method
Also stuff.
method that_method { ... }
1;
Drop it.
44. package YourApp;
# ABSTRACT: my awesome app
=head1 DESCRIPTION
This app is awesome.
=method this_method
This method does stuff.
=cut
method this_method { ... }
=method that_method
Also stuff.
method that_method { ... }
1;
Now our file is simple, just the unique docs and code it needs. It fits on one legible slide!
45. package YourApp;
# ABSTRACT: my awesome app
=head1 DESCRIPTION
This app is awesome.
=method this_method
This method does stuff.
=cut
method this_method { ... }
=method that_method
Also stuff.
method that_method { ... }
1;
And is about half Perl.