Subject: | CGI.pm-1.23.tar.gz should have a dist of "CGI" |
use CPAN::DistnameInfo;
$d = CPAN::DistnameInfo->new(
"http://www.cpan.org/authors/id/L/LD/LDS/CGI.pm-2.34.tar.gz"
);
print $d->dist; # prints CGI.pm
Both CPANPLUS and search.cpan.org identify this dist as CGI, and that
seems more correct and more useful. Makes one less CPAN anomaly to deal
with.
Attached patch strips /.pm$/ off dist names. This only effects a
handful of distributions of which CGI is the only one of consequence. A
bunch of TOMC's random modules also use this convention but they're
anomalous for other reasons.
Thanks.
Subject: | 0001-Normalize-dist-for-CGI.pm.patch |
From f7acb952a6c13016a2b6f23015c5be2924ba4357 Mon Sep 17 00:00:00 2001
From: Michael G. Schwern <schwern@pobox.com>
Date: Wed, 2 Dec 2009 22:58:18 -0800
Subject: [PATCH] Normalize dist() for CGI.pm
---
lib/CPAN/DistnameInfo.pm | 4 ++++
t/path.t | 11 ++++++++++-
2 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/lib/CPAN/DistnameInfo.pm b/lib/CPAN/DistnameInfo.pm
index 67f01ad..a88bd5c 100644
--- a/lib/CPAN/DistnameInfo.pm
+++ b/lib/CPAN/DistnameInfo.pm
@@ -29,6 +29,10 @@ sub distname_info {
$version = $2;
}
+ # Normalize the Dist.pm-1.23 convention which CGI.pm and
+ # a few others use.
+ $dist =~ s{\.pm$}{};
+
$version = $1
if !length $version and $dist =~ s/-(\d+\w)$//;
diff --git a/t/path.t b/t/path.t
index bd2e1a9..a00ad82 100644
--- a/t/path.t
+++ b/t/path.t
@@ -1,5 +1,5 @@
-use Test::More tests => 224;
+use Test::More tests => 233;
use Data::Dumper;
use CPAN::DistnameInfo;
@@ -244,3 +244,12 @@ id/I/IB/IBMTORDB2/DBD-DB2-0.99.tar.bz2
version 0.99
cpanid IBMTORDB2
extension tar.bz2
+
+CPAN/authors/id/L/LD/LDS/CGI.pm-2.34.tar.gz
+ filename CGI.pm-2.34.tar.gz
+ dist CGI
+ maturity released
+ distvname CGI.pm-2.34
+ version 2.34
+ cpanid LDS
+ extension tar.gz
--
1.6.5.2