summaryrefslogtreecommitdiff
path: root/Porting/corelist-perldelta.pl
diff options
context:
space:
mode:
authorAaron Crane <arc@cpan.org>2014-03-20 17:13:56 +0000
committerAaron Crane <arc@cpan.org>2014-03-20 17:21:03 +0000
commitc27d84d919f5c9d4d5292351d434abd2f16e2358 (patch)
treed8227346083c617483f51f4e340b52e4af05160f /Porting/corelist-perldelta.pl
parent54e78c5ec34cae9d6093009691509ca0113b52fd (diff)
downloadperl-c27d84d919f5c9d4d5292351d434abd2f16e2358.tar.gz
Porting/corelist-perldelta.pl: fix bug with 5.*.10 releases
The two aliases of the new Perl version (in this case, "5.01901" and "5.019010") were being selected as the two versions to compare. Unsurprisingly, those two versions have the same modules, so the generated summary of changes was empty.
Diffstat (limited to 'Porting/corelist-perldelta.pl')
-rwxr-xr-xPorting/corelist-perldelta.pl21
1 files changed, 18 insertions, 3 deletions
diff --git a/Porting/corelist-perldelta.pl b/Porting/corelist-perldelta.pl
index 2b00f15c28..da02e7a417 100755
--- a/Porting/corelist-perldelta.pl
+++ b/Porting/corelist-perldelta.pl
@@ -59,9 +59,7 @@ sub run {
);
# by default, compare latest two version in CoreList;
- my @versions = sort keys %Module::CoreList::version;
- my $old = $versions[-2];
- my $new = $versions[-1];
+ my ($old, $new) = latest_two_perl_versions();
# use the provided versions if present
# @ARGV >=2 means [old_version] [new_version] [path/to/file]
@@ -89,6 +87,23 @@ sub run {
exit 0;
}
+sub latest_two_perl_versions {
+
+ my @versions = sort keys %Module::CoreList::version;
+
+ my $new = pop @versions;
+
+ # If a fully-padded version number ends in a zero (as in "5.019010"), that
+ # version shows up in %Module::CoreList::version both with and without its
+ # trailing zeros. So skip all versions that are numerically equal to $new.
+ pop @versions while @versions && $versions[-1] == $new;
+
+ die "Too few distinct core versions in %Module::CoreList::version ?!\n"
+ if !@versions;
+
+ return $versions[-1], $new;
+}
+
# Given two perl versions, it returns a list describing the core distributions that have changed.
# The first three elements are hashrefs corresponding to new, updated, and removed modules
# and are of the form (mostly, see the special remarks about removed):