perl/perl-5.10.0-Module-CoreList2.14.patch
2008-03-18 11:11:31 +00:00

151 lines
4.7 KiB
Diff

diff -up perl-5.10.0/lib/Module/CoreList.pm.crr perl-5.10.0/lib/Module/CoreList.pm
--- perl-5.10.0/lib/Module/CoreList.pm.crr 2007-12-18 11:47:07.000000000 +0100
+++ perl-5.10.0/lib/Module/CoreList.pm 2008-03-17 16:15:07.000000000 +0100
@@ -1,7 +1,7 @@
package Module::CoreList;
use strict;
use vars qw/$VERSION %released %patchlevel %version %families/;
-$VERSION = '2.13';
+$VERSION = '2.14';
=head1 NAME
@@ -138,6 +138,11 @@ sub find_modules {
return sort keys %mods
}
+sub find_version {
+ my ($class, $v) = @_;
+ return $version{$v} if defined $version{$v};
+ return undef;
+}
# when things escaped
%released = (
@@ -176,7 +181,7 @@ sub find_modules {
%patchlevel = (
5.005 => [perl => 1647],
5.00503 => ['maint-5.005' => 3198],
- 5.00405 => ['maint-5.004' => 999],
+ 5.00405 => ['maint-5.004' => 3296],
5.006 => [perl => 5899],
5.006001 => ['maint-5.6' => 9654],
5.006002 => ['maint-5.6' => 21727],
diff -up perl-5.10.0/lib/Module/CoreList/t/corelist.t.crr perl-5.10.0/lib/Module/CoreList/t/corelist.t
diff -up perl-5.10.0/lib/Module/CoreList/t/pod.t.crr perl-5.10.0/lib/Module/CoreList/t/pod.t
--- perl-5.10.0/lib/Module/CoreList/t/pod.t.crr 2008-03-18 09:43:20.000000000 +0100
+++ perl-5.10.0/lib/Module/CoreList/t/pod.t 2006-02-01 14:38:29.000000000 +0100
@@ -0,0 +1,10 @@
+#!perl
+
+use Test::More;
+eval "use Test::Pod 1.00";
+plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
+
+plan tests => 2;
+
+pod_file_ok( 'lib/Module/CoreList.pm', 'module pod ok' );
+pod_file_ok( 'corelist', 'script pod ok' );
diff -up perl-5.10.0/lib/Module/CoreList/t/find_modules.t.crr perl-5.10.0/lib/Module/CoreList/t/find_modules.t
diff -up perl-5.10.0/lib/Module/CoreList/bin/corelist.crr perl-5.10.0/lib/Module/CoreList/bin/corelist
--- perl-5.10.0/lib/Module/CoreList/bin/corelist.crr 2007-12-18 11:47:07.000000000 +0100
+++ perl-5.10.0/lib/Module/CoreList/bin/corelist 2008-03-17 16:14:59.000000000 +0100
@@ -11,14 +11,14 @@ See L<Module::CoreList> for one.
=head1 SYNOPSIS
corelist -v
- corelist [-a] <ModuleName> | /<ModuleRegex>/ [<ModuleVersion>] ...
+ corelist [-a|-d] <ModuleName> | /<ModuleRegex>/ [<ModuleVersion>] ...
corelist [-v <PerlVersion>] [ <ModuleName> | /<ModuleRegex>/ ] ...
=head1 OPTIONS
=over
-=item -a modulename
+=item -a
lists all versions of the given module (or the matching modules, in case you
used a module regexp) in the perls Module::CoreList knows about.
@@ -44,6 +44,11 @@ used a module regexp) in the perls Modul
5.009002 1.04
5.009003 1.06
+=item -d
+
+finds the first perl version where a module has been released by
+date, and not by version number (as is the default).
+
=item -? or -help
help! help! help! to see more help, try --man.
@@ -79,7 +84,7 @@ use warnings;
my %Opts;
-GetOptions(\%Opts, qw[ help|?! man! v|version:f a! ] );
+GetOptions(\%Opts, qw[ help|?! man! v|version:f a! d ] );
pod2usage(1) if $Opts{help};
pod2usage(-verbose=>2) if $Opts{man};
@@ -93,15 +98,16 @@ if(exists $Opts{v} ){
}
$Opts{v} = numify_version( $Opts{v} );
- if( !exists $Module::CoreList::version{$Opts{v}} ) {
+ my $version_hash = Module::CoreList->find_version($Opts{v});
+ if( !$version_hash ) {
print "\nModule::CoreList has no info on perl v$Opts{v}\n\n";
exit 1;
}
if ( !@ARGV ) {
print "\nThe following modules were in perl v$Opts{v} CORE\n";
- print "$_ ", $Module::CoreList::version{$Opts{v}}{$_} || " ","\n"
- for sort keys %{$Module::CoreList::version{$Opts{v}}};
+ print "$_ ", $version_hash->{$_} || " ","\n"
+ for sort keys %$version_hash;
print "\n";
exit 0;
}
@@ -149,12 +155,17 @@ sub module_version {
my($mod,$ver) = @_;
if ( $Opts{v} ) {
- return printf " %-24s %-10s\n",
- $mod,
- $Module::CoreList::version{$Opts{v}}{$mod} || 'undef';
+ my $version_hash = Module::CoreList->find_version($Opts{v});
+ if ($version_hash) {
+ print $mod, " ", $version_hash->{$mod} || 'undef', "\n";
+ return;
+ }
+ else { die "Shouldn't happen" }
}
- my $ret = Module::CoreList->first_release(@_);
+ my $ret = $Opts{d}
+ ? Module::CoreList->first_release_by_date(@_)
+ : Module::CoreList->first_release(@_);
my $msg = $mod;
$msg .= " $ver" if $ver;
@@ -184,13 +195,12 @@ sub module_version {
sub numify_version {
my $ver = shift;
- if ( index( $ver, q{.}, index( $ver, q{.} ) ) >= 0 ) {
- eval { require version };
- if ($@) {
- die "You need to install version.pm to use dotted version numbers\n";
- }
+ if ($ver =~ /\..+\./) {
+ eval { require version ; 1 }
+ or die "You need to install version.pm to use dotted version numbers\n";
$ver = version->new($ver)->numify;
}
+ $ver += 0;
return $ver;
}