From: Vincent Pit Date: Thu, 14 Jun 2012 23:11:48 +0000 (+0200) Subject: Try to lookup unknown dists as modules X-Git-Tag: v0.12~3 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=363cb060a54409c7ae3032978b3db8eadbead176;p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git Try to lookup unknown dists as modules This catches Template-Latex correctly in Template-Plugin-Latex. --- diff --git a/lib/CPANPLUS/Dist/Gentoo/Maps.pm b/lib/CPANPLUS/Dist/Gentoo/Maps.pm index fb2cbd6..957450d 100644 --- a/lib/CPANPLUS/Dist/Gentoo/Maps.pm +++ b/lib/CPANPLUS/Dist/Gentoo/Maps.pm @@ -410,6 +410,7 @@ Pod-Parser PodParser Regexp-Common regexp-common Set-Scalar set-scalar String-CRC32 string-crc32 +Template-Plugin-Latex Template-Latex Text-Autoformat text-autoformat Text-Reform text-reform Text-Template text-template diff --git a/samples/gengentooisms b/samples/gengentooisms index 980ecbf..03253e0 100755 --- a/samples/gengentooisms +++ b/samples/gengentooisms @@ -32,6 +32,8 @@ use constant STATE_FILE => 'gentooisms.state.sto'; my %is_on_cpan = ( 'Audio-CD-disc-cover' => 0, + 'Video-Frequencies' => 0, + 'Sphinx-Search' => 1, 'WattsUp-Daemon' => 1, ); @@ -193,6 +195,28 @@ sub parse_portage_tree { local $@; eval { $pcp->latest_distribution($pseudo_dist->dist) }; }; + + unless (defined $latest_dist) { + print "no\n"; + p(2, 'is similiar to a module indexed in another distribution of the CPAN... '); + (my $mod_name = $pkg_name) =~ s/-/::/g; + $latest_dist = do { + local $@; + eval { + my $module = $pcp->package($mod_name); + defined $module ? $module->distribution : undef; + }; + }; + if (defined $latest_dist) { + # Re-forge the pseudo dist so that it will pick up the correct dist + # name when looking for a mismatch. + $pseudo_dist = CPAN::DistnameInfo->new( + $latest_dist->dist . '-' . $pseudo_dist->version + . '.' . $pseudo_dist->extension + ); + } + } + my ($latest_file, $latest_author); if (defined $latest_dist) { $latest_file = $latest_dist->filename;