Change 33867 by [EMAIL PROTECTED] on 2008/05/19 15:14:25

        Integrate:
        [ 33615]
        Integrate:
        [ 33244]
        corelist changes:
        - Add a new -d option to find first perl version by date
          and not by version number
        - Better handling of perl versions that end with a 0
        - use version.pm only for version numbers that have multiple dots
        
        [ 33503]
        Regexp::DESTROY was only added in 5.8.1

Affected files ...

... //depot/maint-5.8/perl/ext/Opcode/Safe.pm#10 integrate
... //depot/maint-5.8/perl/lib/Module/CoreList.pm#4 integrate
... //depot/maint-5.8/perl/lib/Module/CoreList/bin/corelist#2 integrate

Differences ...

==== //depot/maint-5.8/perl/ext/Opcode/Safe.pm#10 (text) ====
Index: perl/ext/Opcode/Safe.pm
--- perl/ext/Opcode/Safe.pm#9~33172~    2008-02-01 11:03:16.000000000 -0800
+++ perl/ext/Opcode/Safe.pm     2008-05-19 08:14:25.000000000 -0700
@@ -3,7 +3,7 @@
 use 5.003_11;
 use strict;
 
-$Safe::VERSION = "2.15";
+$Safe::VERSION = "2.16";
 
 # *** Don't declare any lexicals above this point ***
 #
@@ -46,7 +46,6 @@
 my $default_share = [qw[
     *_
     &PerlIO::get_layers
-    &Regexp::DESTROY
     &UNIVERSAL::isa
     &UNIVERSAL::can
     &UNIVERSAL::VERSION
@@ -58,7 +57,9 @@
     &utf8::downgrade
     &utf8::native_to_unicode
     &utf8::unicode_to_native
-], ($] >= 5.010 && qw[
+], ($] >= 5.008001 && qw[
+    &Regexp::DESTROY
+]), ($] >= 5.010 && qw[
     &re::is_regexp
     &re::regname
     &re::regnames

==== //depot/maint-5.8/perl/lib/Module/CoreList.pm#4 (text) ====
Index: perl/lib/Module/CoreList.pm
--- perl/lib/Module/CoreList.pm#3~33199~        2008-02-02 09:39:01.000000000 
-0800
+++ perl/lib/Module/CoreList.pm 2008-05-19 08:14:25.000000000 -0700
@@ -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 @@
     return sort keys %mods
 }
 
+sub find_version {
+    my ($class, $v) = @_;
+    return $version{$v} if defined $version{$v};
+    return undef;
+}
 
 # when things escaped
 %released = (

==== //depot/maint-5.8/perl/lib/Module/CoreList/bin/corelist#2 (text) ====
Index: perl/lib/Module/CoreList/bin/corelist
--- perl/lib/Module/CoreList/bin/corelist#1~32312~      2007-11-14 
10:09:03.000000000 -0800
+++ perl/lib/Module/CoreList/bin/corelist       2008-05-19 08:14:25.000000000 
-0700
@@ -11,14 +11,14 @@
 =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 @@
       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 @@
 
 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 @@
     }
 
     $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 ( [EMAIL PROTECTED] ) {
        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 @@
     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 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;
 }
 
End of Patch.

Reply via email to