in reply to CPANPLUS won't install distros by name (e.g. Scalar-List-Utils)

Perhaps you could have raised a RT ticket for this issue.

Perhaps then either myself or Jos would have been able to investigate the issue. It is only because I happened to being checking perlmonks today that I spotted this.

You hit the nail on the head, it is the distributions that have package names that are slightly unusual that parse_module has a problem with. In the vast majority of cases it can make an educated guess and get it right.

CPANPLUS' module tree is exactly that, a tree of modules, which includes the name of the package that that module is contained in. Creating a mapping back the other way as well, ie. PACKAGE -> MODULE, is going to add more memory usage for the indexes.

That said, there may be a way. I'm digging further.

But please, do raise that ticket, so I don't forget.

CPANPLUS RT Queue

Updated:

Found a possible solution which I will endeavour to roll into the next release. In the meantime this should work for those pesky edge-cases:

use strict; use warnings; use CPANPLUS::Backend; my $cb = CPANPLUS::Backend->new(); my $string = shift || die; my $mod; unless ( $mod = $cb->parse_module( module => $string ) ) { ($mod) = grep { $_->package_name eq $string } $cb->search( type => 'package', allow => [ qr/^\Q$str +ing\E/ ], ); } print $mod->name, ' ', $mod->package, "\n" if $mod;
  • Comment on Re: CPANPLUS won't install distros by name (e.g. Scalar-List-Utils)
  • Download Code

Replies are listed 'Best First'.
Re^2: CPANPLUS won't install distros by name (e.g. Scalar-List-Utils)
by Anonymous Monk on Nov 10, 2009 at 16:39 UTC

    ... it is the distributions that have package names that are slightly unusual that parse_module has a problem with. {snip}

    ... CPANPLUS' module tree is exactly that, a tree of modules, which includes the name of the package that that module is contained in.

    Just to confirm the terminology:

    • distribution -- (the tar.gz file) Ex., WWW-Mechanize-1.60.tar.gz
    • module -- (the .pm file) Ex., WWW/Mechanize/Link.pm
    • package -- Ex., WWW::Mechanize::Link
Re^2: CPANPLUS won't install distros by name (e.g. Scalar-List-Utils)
by wu-lee (Beadle) on Nov 11, 2009 at 23:30 UTC
    Thanks. I was planning to submit a bug, unless it turned out I'd missed something. Done now.

    The work-around seems to do the job, too (although I can't find any way to switch off CPANPLUS's failure warnings when the first parse_module fails...)