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.
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;
|
|---|
| 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 | |
|
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 | |
by Anonymous Monk on Nov 12, 2009 at 00:19 UTC |