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.
Less Features
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:
==> HTTP::Body
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)
Minor improvements
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 :)
Great news. I'm a fan myself and looking forward for the 1.0 release.
Posted by: Dexter Tad-y | 2010.04.12 at 05:17
I'm a bit confused about the 'look' support. You mentioned removing --look as a command option but look is allowed during install when there's an error. Personally I used --look quite often, since when I am debugging trouble in a Makefile.PL its a useful tool to try and track down exactly where the error is. Quite often the trouble is in a dependency further down the chain.
Anyway, I understand wanting to keep with the 'minus' meaning and there are other ways to do what I need. I'd personally miss --look though :) I actually pointed it out to my coworkers as part of my debugging workflow.
Posted by: john napiorkowski | 2010.04.12 at 06:10
You can just use the new client that will have 'look' command.
Posted by: miyagawa | 2010.04.12 at 06:33
Thank you for clarifying :)
Posted by: john napiorkowski | 2010.04.12 at 10:39
An option to look at the TAP would be very handy.
You can always get another look at the failure by selecting “look” and then running the tests manually, but some modules have test suites that can take several minutes to run on slower machines.
Posted by: Aristotle Pagaltzis | 2010.04.12 at 11:01
i got two other people wanting --look command as well, so i just reverted it back -- since it's just two lines of code :)
Posted by: miyagawa | 2010.04.12 at 14:39
yeah, that's a very handy for developers, not 99.9% of the cpanm target audience. So i guess you can write a plugin to do that for the new client.
Posted by: miyagawa | 2010.04.12 at 14:40
Great Man ! I am curiously waiting for the release of 1.0. It is looking great. I will definitely use it. Thank you very much !
Posted by: software testing services | 2010.06.21 at 00:01