my ($old_ver, $new_ver) = @ARGV;
- my $old = $Module::CoreList::version{ numify_version($old_ver) };
- my $new = $Module::CoreList::version{ numify_version($new_ver) };
+ my $old = numify_version($old_ver);
+ my $new = numify_version($new_ver);
- my %uniq = (%$old, %$new);
- for my $lib (sort keys %uniq) {
- my $old = exists $old->{ $lib }
- ? (defined $old->{ $lib } ? $old->{ $lib } : '(undef)')
- : '(absent)';
- my $new = exists $new->{ $lib }
- ? (defined $new->{ $lib } ? $new->{ $lib } : '(undef)')
- : '(absent)';
+ my %diff = Module::CoreList::changes_between($old, $new);
- next if $old eq $new;
+ for my $lib (sort keys %diff) {
+ my $diff = $diff{$lib};
- printf "%-35s %10s %10s\n", $lib, $old, $new;
+ my $was = ! exists $diff->{left} ? '(absent)'
+ : ! defined $diff->{left} ? '(undef)'
+ : $diff->{left};
+
+ my $now = ! exists $diff->{right} ? '(absent)'
+ : ! defined $diff->{right} ? '(undef)'
+ : $diff->{right};
+
+ printf "%-35s %10s %10s\n", $lib, $was, $now;
}
exit(0);
}
return @removed;
}
+sub changes_between {
+ my ($left_ver, $right_ver) = @_;
+
+ my $left = $version{ $left_ver };
+ my $right = $version{ $right_ver };
+
+ my %uniq = (%$left, %$right);
+
+ my %changes;
+ for my $lib (keys %uniq) {
+ my $lhs = exists $left->{ $lib }
+ ? (defined $left->{ $lib } ? $left->{ $lib } : '(undef)')
+ : '(absent)';
+ my $rhs = exists $right->{ $lib }
+ ? (defined $right->{ $lib } ? $right->{ $lib } : '(undef)')
+ : '(absent)';
+
+ next if $lhs eq $rhs;
+
+ my $change = {
+ (exists $left->{$lib} ? (left => $left->{$lib}) : ()),
+ (exists $right->{$lib} ? (right => $right->{$lib}) : ()),
+ };
+
+ $changes{$lib} = $change;
+ }
+
+ return %changes;
+}
+
# When things escaped.
# NB. If you put version numbers with trailing zeroes here, you
# should also add an alias for the numerical ($]) version; see
was removed from core. Returns undef if the given module was never in core or remains
in core.
+=item C<changes_between( PERL_VERSION, PERL_VERSION )>
+
+Available in version 2.66 and above.
+
+Given two perl versions, this returns a list of pairs describing the changes in
+core module content betweent hem. The list is suitable for storing in a hash.
+The keys are library names and the values are hashrefs. Each hashref has an
+entry for one or both of C<left> and C<right>, giving the versions of the
+library in each of the left and right perl distributions.
+
+For example, it might return these data (among others) for the the difference
+between 5.008000 and 5.008001:
+
+ 'Pod::ParseLink' => { left => '1.05', right => '1.06' },
+ 'Pod::ParseUtils' => { left => '0.22', right => '0.3' },
+ 'Pod::Perldoc' => { right => '3.10' },
+ 'Pod::Perldoc::BaseTo' => { right => undef },
+
+This shows us two libraries being updated and two being added, one of which has
+an undefined version in the right-hand side version.
+
=back
=head1 DATA STRUCTURES