cpanm 1.4 is out last night. This is a major update and includes bunch of good things, and let me introduce two of them.
-q is the real quiet option
One of the things people love about cpanm is its quiet output, compared to CPAN.pm's default verbosity level. cpanm by default only prints 4 lines per module installation, namely "Fetching, Configuring, Building, Installed". We also used to have -q
option since day 1, which silences all output, which is not really that useful unless you run it from another program.
1.4 makes the -q
option less quiet - it shows only the line "Successfully installed module-ver" per one module install (or a failure message if the installation fails). This is a major achievement, and I already love this output, and now put "--quiet" into my PERL_CPANM_OPT
environment variable.
> cpanm -q DBI Plack Catalyst
Successfully reinstalled DBI-1.616
Successfully reinstalled Plack-0.9974
Successfully reinstalled Catalyst-Runtime-5.80032
3 distributions installed
Now you see it prints the number of distribution installed in the last output as well? I like it too :)
If you want the original, absolute no output option, you can just pipe the stdout and stderr output to /dev/null.
--scandeps, --format
Another great feature cpanm 1.4 brings in is the new --scandeps
command. This is now built in to the cpanminus dependency resolution system, and instead of building and installing a distribution, it scans the dependency tree and prints them as a text tree format, by default.
> cpanm -q --scandeps Catalyst::Runtime
Catalyst-Runtime-5.80032
\_ Sub-Exporter-0.982
\_ Params-Util-1.03
\_ Sub-Install-0.925
\_ Data-OptList-0.106
\_ MooseX-Emulate-Class-Accessor-Fast-0.00903
\_ namespace-clean-0.20
...
This takes into consideration that which modules you already have in your library path, so only the modules that you have to install or upgrade will be printed. If you try to see the dep tree against the vanilla perl, you can combine it with the -L
option.
--scandeps
command now takes --format
option too, so that you can print this information as a JSON/YAML format to use in a different program, or the dists
format which is pretty interesting: it prints out the AUTHOR/Dist-ver.tar.gz
format in the depth first search order, which means you can replay the installation in other machines by saving the output and the tarball as well, which you can do with the new --save-dists
option.
There are some occasions where --scandeps doesn't work like expected. See the Wiki page first if the Known Issues there explains your situation.
There are other improvements like a better core module detection in -L
, and the support for Bundle:: modules.
Try out the new great cpanm 1.4 by running cpanm --self-upgrade
.
Note that this is probably the last major update for cpanminus. I'll react to bug fixes and toolchain updates, but the effort to make a great, minimal CPAN client has reached its goal.
I still have a plan to write a new client, and that's in the works already :)
miyagawa,
Would removing of modules fit cpanm's philosophy? cpanm is already today a great tool. Removing modules would make cpanm unique.
Posted by: Nxadm.wordpress.com | 2011.03.08 at 13:29
Nxadm: CPANPLUS provides the uninstall command, and for cpanm, you can use App::pmuninstall which installs the pm-uninstall command for you. The new client will integrate this feature built in.
Posted by: miyagawa | 2011.03.08 at 13:40
@miyagawa: congrats for the 1.4 release. Loooove the one-module-per-line -q output, making mass upgrade so much easier to look at.
@Nxadm: there's App::pmuninstall for that.
Posted by: Steven Haryanto | 2011.03.08 at 13:52
Miyagawa, thanks for all your hard work. I don't understand the need for the --self-upgrade option. Is that any better than running 'cpanm cpanm' or 'cpanm App::cpanminus' ?
Posted by: Ironcamel | 2011.03.08 at 14:25
ironcamel: yeah it's just an alias for that command, if you know what it is, you don't really need it :)
Posted by: miyagawa | 2011.03.08 at 14:27
cpanm cpanm looks much cooler :)
Posted by: Ironcamel | 2011.03.08 at 14:44
Yeah, the problem is "cpanm" is neither a module nor distribution name, so the standard package lookup fails. cpanm *happens to* work because search.cpan.org supports the executable lookup (Thanks gbarr). cpanm App::cpanminus should always work fine, though.
Posted by: miyagawa | 2011.03.08 at 14:48
I understood it like this: cpanm foo will install the distribution that provides the executable foo, as long as only one distribution provides that executable. Is that correct?
Posted by: Ironcamel | 2011.03.08 at 14:58
I "guess" so. It's just search.cpan.org works that way (I guess!), and you might be fooled if graham barr changes the behavior.
Posted by: miyagawa | 2011.03.08 at 14:59
I love cpanm. Thanks for making it even better.
Posted by: John Beppu | 2011.03.10 at 14:47