I'm now in Vienna, Austria to join the Perl QA Hackathon 2010.
The hackathon is sponsored by Vienna perl mongers and 123people, and all the accommodation and flights are paid by them. I appreciate their help to make CPAN QA/Testing toolchain better.
On day 1 and 2 i've been working on fixing bugs and wishlists for cpanminus supposedly, and just now i shipped cpanminus 0.999_01, the first release candidate for cpanminus 1.0. I'll tell you what's new for this release.
The name cpan "minus" has just started as a counter joke for the CPANPLUS client, and adding features to what's supposed to be config-free and deps-free and tiny/light/whatever just doesn't sound right. So i deleted all the developers-oriented features from cpanminus, such as:
- plugins support
- --recent command
Until that happens, you can continue using the cpanminus 0.9934, which is the last version of the cpanm that supports plugins.
More metadata retrieval
I refactored the code base so cpanm always resolves the package name to distribution using CPAN Meta DB and then use search.cpan.org's metadata index service before downloading the tarball. This makes lots of command run faster, especially the --skip-installed option.
Prompts on failures
One of the thing that annoys you when installing CPAN modules is the test failures. I mean, testing is a great culture of Perl and CPAN but when the test fails, CPAN clients refuses to install without the 'force' mode, and it's so annoying.
cpanminus default behavior is consistent to other clients as CPAN.pm or CPANPLUS: the module is not installed when the test fails (unless --force is specified).
In 1.0 we add --prompt option, which gives you the chance to fix the failures. When you run cpanm with --prompt option (which you can set by default if you set it in PERL_CPANM_OPT environment variable), and the test fails, it asks you:
Testing CPAN-Test-Dummy-Perl5-Build-Fails-1.03 failed.
You can s)kip, r)etry, f)orce install or l)ook ? [s]
It might be obvious, but "skip", the default choice is to skip installing the module and proceed with other dependencies. "retry" re-runs the test again to see if it was a temporary failure. "force" would, obviously, force install the module, which is very handy if you're really sure that it's just a bad test failure that doesn't matter.
Also, the "look" command is pretty nice. It allows you to open the working directory with the shell, pretty much like CPAN.pm's 'look' command, to see if there's any missing configuration in your system, and you can fix there. And you exit the sub shell and type 'r' to retry installing the module.
Of course you can hit Control-c in the prompt to bail out the entire installation process.
Bailing out when dependencies fail
This is related to the previous section, but cpanminus 1.0 changed the behavior when one ore more dependencies failed to install.
Say, you're trying to install Plack and all of its dependencies. Imagine one of its dependencies, like HTTP::Body, failed the test and hence not installed.
Previously, cpanminus still continues the build process of Plack itself, and if Plack doesn't define an unit test that uses HTTP::Body, the test accidentally passes and cpanminus succeeds to install Plack. The end result is that Plack is installed to your system, however when you're trying to use Plack::Request, you'll get a runtime error like "Can't locate HTTP/Body.pm in @INC ...".
This is a broken installation and should be avoided.
cpanminus 1.0 will bail out the build process when one or more dependencies failed to install, by default. With --prompt option enabled, cpanminus will ask you:
Installing the following dependencies failed:
Do you want to continue building Plack-0.9928 anyway? [n]
So if you're really sure that the dependency failure doesn't matter, you can still continue installing the module by hitting 'y'. Of course you can also use the --force option to force install anything, like you've always been able to.
(Note that Plack thing is just an example, and since Plack has tests that uses HTTP::Body, it won't happen :D)
These are the major improvements and changes in cpanminus 1.0 but there are more minor improvements. Such as setting a proper exit code, better error messages, uninstalling shadows by default and being able to specify your favorite mirror with --mirror. See the Changes file or the newly added `man cpanm` to see all the details.
I'll start working on a new CPAN client, as well as specifying cpanminus API so that the new client can make use of it. Stay tuned :)