Entering MooseX, XVIII Now We Package
Well starting today to look at Dist::Zilla and as I develop mostly on a Winders box (yes I know I a not a real Perl programmer) I had a look at the Testing Matrix to make sure I can use it and I can. So step two was a doing the install and it does have quite the dependency list and my Perl is quite sparse in terms of installations so it took a good half-hour to install all the needed modules and this is my new super fast 64k super gaming lap top so I would think it is a little slow but it does go in
Now looking at the POD it is very well documented and and it even has its own web site which is quite well laid out and easy toe use.
So onto brass tacks I started by reading though the tutorial; well in a word comprehensive and quite novel as he sort of based it one those old 'Have your on Adventure Books, (as I remember them I was always getting eaten by a Troll by my third or fourth choice ). It gives a very good overview of the entire release process and what Dist::Zilla gives you.
Now in my case I have my code and tests written I really just need to get the other nasty bits added in so I will not choose the 'Building From Scratch' as I see it creates files for you so that might kill the ones I already have, So I will give the conversion tutorial a go.
So the first thing I must do is get rid of the Makefile.PL I don't have one of those yet so that is easy next I have to add a 'dist.ini' which will look like this for me
name = MooseX::AuthorizedMethodRoles
version = 0.001
author = John Scoles
Ok so var but what about the
license = Perl_5
I like to use GNU so I had to go lookup what my options are for this it seems that this must point to a 'Software::License' package and a quick look there I found it as it was quite simple the licensee are found here listed as GPL_1
So I need
license = GPL_1
copyright_holder = John Scoles
[GatherDir]
[MetaYAML]
[MakeMaker]
[Manifest]
Now from my reading these little directives (the documentation calls them plugins so I will from now on as well), will go out and do some work (hopefully correctly) first 'gathers all the files in a directory ' then I am telling it to create my Meta.yml file then my MakeFile.PL and then I tell it create my Manifest. Now the neat thing about these little plugins is they can take any number of params and I can also write my own. Also the the documentation is quite good as it only takes a few moments on the main page to see almost all of the plugins that are out there or at least the ones that come standard.
next we have
[Prereqs]
Carp = 0
List::MoreUtils = 0.09
Sub::Exporter = 0.90
UDCode = 0
Now I will have to change the above but I am rather lazy and not 100% sure what is required in my Mod so I does Dist::Zilla do this for me? Why yes as I see there is a 'AutoPrereqshave' plugin so I will use that instead;
[AutoPrereqshave]
Well as this is only the 10c tour for tonight lets see what we get with. Now to 'do stuff' with Dist::Zilla it comes with a command line tool call 'dzil', don't bother following the link to see the documentation there isn't much to it however
$ dzil command
will get you this
dzil <command> [-Iv] [long options...]
-v --verbose log additional output
-I --lib-inc additional @INC dirs
Available commands:
commands: list the application's commands
help: display a command's help screen
add: add modules to an existing dist
authordeps: list your distribution's author dependencies
build: build your dist
clean: clean up after build, test, or install
install: install your dist
listdeps: print your distribution's prerequisites
new: mint a new dist
nop: do nothing: initialize dzil, then exit
release: release your dist
run: run stuff in a dir where your dist is built
setup: set up a basic global config file
smoke: smoke your dist
test: test your dist
so in my case I am going to give 'smoke' a whirl as it sounds the coolest
so I give it a try and get
...
no configuration (e.g, dist.ini) found at C:/Dwimperl/perl/site/lib/Dist/Zilla/
pp.pm line 126
Opps I forgot (as usual) to read the first little bit of the tutorial and run
dzil setup
first and type in answers to the few little questions it asks me. So did than and now lets go again
and this time
Attribute (name) does not pass the type constraint because: MooseX::AuthorizedMe
thodRoles looks like a module name, not a dist name at C:\Dwimperl\perl\site\lib
\Moose\Exception.pm line 37
ok will fix that
Ok again and this time
[DZ] building distribution under .build\KNHAki41Qp for installation
[DZ] beginning to build MooseX-AuthorizedMethodRoles
[DZ] guessing dist's main_module is lib/MooseX/AuthorizedMethodRoles.pm
[DZ] extracting distribution abstract from lib/MooseX/AuthorizedMethodRoles.pm
[DZ] writing MooseX-AuthorizedMethodRoles in .build\KNHAki41Qp
Checking if your kit is complete...
Looks good
Warning: prerequisite test_role1 0 not found.
Warning: prerequisite test_role2 0 not found.
Warning: prerequisite test_role3 0 not found.
Writing Makefile for MooseX::AuthorizedMethodRoles
Writing MYMETA.yml and MYMETA.json
cp lib/MooseX/Meta/Method/Role/Authorized.pm blib\lib\MooseX\Meta\Method\Role\Au
...
took out the boring copy parts
...
t/00-Load.t ........ ok
...
and the tests ;)
All tests successful.
Files=6, Tests=3, 46 wallclock secs ( 0.23 usr + 0.02 sys = 0.07 CPU)
Result: PASS
[DZ] all's well; removing .build\OzQmJVDYVD
And that is it. Lest see what went on obvioulsy 'DZ' is a messages from Dist::Zillia and it dose give me a warning, seems it likes to include my internal roles for some reason, lets look on the dir
Opps didn't create any files for me. I guess 'smoke' is really just a test lets give it one more try for tonight.
$ dzil build
[DZ] beginning to build MooseX-AuthorizedMethodRoles
[DZ] guessing dist's main_module is lib/MooseX/AuthorizedMethodRoles.pm
[DZ] extracting distribution abstract from lib/MooseX/AuthorizedMethodRoles.pm
[DZ] writing MooseX-AuthorizedMethodRoles in MooseX-AuthorizedMethodRoles-0.001
[DZ] building archive with Archive::Tar; install Archive::Tar::Wrapper 0.15 or n
ewer for improved speed
[DZ] writing archive to MooseX-AuthorizedMethodRoles-0.001.tar.gz
as lets see
so under my 'Moosex-AuthorizedMethodRoles' dir I get another dir 'Moosex-AuthorizedMethodRoles-0.001' and in that one I see my Makefile.PL, MANIFEST and META.yml
Now what I am really interested in is the Makefile.PL
So a I had quick look in there and it looked ok but I did not know I had so many Deps in this module
"PREREQ_PM" => {
"Data::Dumper" => 0,
"Devel::PartialDump" => 0,
"List::Util" => 0,
"Moose" => 0,
"Moose::Exporter" => 0,
"Moose::Meta::TypeCoercion" => 0,
"Moose::Meta::TypeConstraint" => 0,
"Moose::Meta::TypeConstraint::Parameterizable" => 0,
"Moose::Role" => 0,
"Moose::Util::MetaRole" => 0,
"Moose::Util::TypeConstraints" => 0,
"Sub::Name" => 0,
"UNIVERSAL" => 0,
"aliased" => 0,
"namespace::autoclean" => 0,
"strict" => 0,
"warnings" => 0
},
Well a very comprehensive list I would of maybe put in Moose::Util neat to see this.
It even does a this for Test;
"TEST_REQUIRES" => {
"Test::Moose::More" => 0,
"Test::More" => 0
},
and is does a Fallback as well, cool;
my %FallbackPrereqs = (
"Data::Dumper" => 0,
"Devel::PartialDump" => 0,
"List::Util" => 0,
"Moose" => 0,
"Moose::Exporter" => 0,
"Moose::Meta::TypeCoercion" => 0,
"Moose::Meta::TypeConstraint" => 0,
"Moose::Meta::TypeConstraint::Parameterizable" => 0,
"Moose::Role" => 0,
"Moose::Util::MetaRole" => 0,
"Moose::Util::TypeConstraints" => 0,
"Sub::Name" => 0,
"Test::Moose::More" => 0,
"Test::More" => 0,
"UNIVERSAL" => 0,
"aliased" => 0,
"namespace::autoclean" => 0,
"strict" => 0,
"warnings" => 0
);
Well a good start will have to fix up those few little issues I had but in all a good experience.
Leave a comment