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

sudo cpan install Foo::Bar must actually be sudo cpan Foo::Bar.

Installing modules with cpan is the most frequent task, so you don't have to give it any command. Just give it the module names and let it go. I think its pretty clear from the documentation how you are supposed to call it. If there's something that it's not doing correctly, send me a bug report.

I'm not sure why you have to quit the CPAN shell when it doesn't see optional modules. If Test::Pod::Coverage isn't there, who cares? Why do you let that mess up your life? That module is designed and intended to be optional. It doesn't test any code, so it doesn't really matter. If it fails, you probably don't want to stop the module install process. We specifically make those modules optional so you don't have to install them and it's not more work for you. If you run across a distro that doesn't declare its prereqs correctly or completely, that's not the shell's fault and you should report it as a bug of the distro.

--
brian d foy <brian@stonehenge.com>
Subscribe to The Perl Review

Replies are listed 'Best First'.
Re^3: [rant] Of the suckage of the CPAN shell
by TilRMan (Friar) on Jul 12, 2006 at 03:36 UTC

    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.

Re^3: [rant] Of the suckage of the CPAN shell
by xdg (Monsignor) on Jul 11, 2006 at 19:12 UTC

    sudo cpan install Foo::Bar must actually be sudo cpan Foo::Bar.

    Installing modules with cpan is the most frequent task, so you don't have to give it any command. Just give it the module names and let it go. I think its pretty clear from the documentation how you are supposed to call it. If there's something that it's not doing correctly, send me a bug report.

    You have to know what he's talking about to get this one. It's not a bug, it's a "feature". Look at http://search.cpan.org/search?query=install&mode=module.

    If you mistakenly type "cpan install Foo::Bar", you wind up installing the distribution junoscript-perl. It's easy to make the mistake and type "install" and many people don't even notice that junoscript has also been installed if they aren't watching closely.

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.