module_builder.pl - A simple demo that unpacks, builds and tests perl module tarballs.
$ module_builder.pl My-Module-0.01.tar.gz Verby-0.01.tar.gz
As this is not really a useful program, we'll look at how it's written, not how it's used.
Foreach tarball given on the command line, several steps are created, all of them Verby::Step::Closure objects. Each step depends on the step before it.
First the context variable untar_dir is created. This is where all the tarballs will be unpacked to. Because we're so silly, untar_dir is actually set by "cwd" in Cwd, so this is basically a no-op.
untar_dir
It has provide_cxt, meaning that all it's dependant steps and it share a common Verby::Context, separate from other steps.
provide_cxt
The next step is to unpack the tarball. The before handler in Verby::Step::Closure will set the tarball context variable to the argument being processed, and the dest context variable to the untar_dir context variable.
before
tarball
dest
The after handler sets the workdir variable to the value of the src_dir variable, and exports workdir so that it's accessible to subsequent steps.
after
workdir
src_dir
The next thing to do is run the Makefile.PL file. We set workdir to src_dir in the previous step, and that's all we need.
Makefile.PL
After we've finished running Makefile.PL we can run make(1) with no arguments. This is exactly what this step does. It is also affected by the previously exported workdir.
Now we run make(1) again, but this time with the test target.
test
Since most actions are asynchroneous, modules will be built in parallel. Isn't that cool?
Yuval Kogman, <nothingmuch@woobling.org>
Copyright 2005, 2006 by Infinity Interactive, Inc.
http://www.iinteractive.com
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Verby, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Verby
CPAN shell
perl -MCPAN -e shell install Verby
For more information on module installation, please visit the detailed CPAN module installation guide.