Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re^3: [rant] Of the suckage of the CPAN shell

by TilRMan (Friar)
on Jul 12, 2006 at 03:36 UTC ( [id://560606] : note . print w/replies, xml ) Need Help??

in reply to Re^2: [rant] Of the suckage of the CPAN shell
in thread [rant] Of the suckage of the CPAN shell

I've fallen for the 'cpan install' feature so many times without knowing why that I've just gotten in the habit of using perl -MCPAN. Now that I know why, I'd say the interface of cpan(1) violates the Principle of Lease Surprise, but that's just me. To illustrate:

$ perl -MCPAN -e shell # Right cpan> install Foo $ perl -MCPAN -e 'install Foo' # Right $ cpan # Right cpan> install Foo $ cpan install Foo # WRONG!

I think a good compromise would be to special case the distro called 'install' and have cpan(1) refuse to install it unless the -i option is thrown explicitly (or if it is the only item listed, perhaps). And a nice helpful error message if it isn't, such as:

It appears you may be trying to install the 'install' distribution. If this is what you want, use the -i flag as well. If what you really want is to install the '@ARGV[1..-1]' module(s), use the -i flag and omit install. Read perldoc cpan for more information.

And then put a lengthy discussion in the manpage.

I think a good solution would involve the compromise above, plus the deletion of the 'install' distribution, plus the lifetime imprisonment of anyone who ever does or ever has uploaded a distribution called 'install'. But that's just me.