From dd413713151de77cdfaff8f2bc6cf65d2a2d39af Mon Sep 17 00:00:00 2001 From: Chris 'BinGOs' Williams Date: Thu, 14 Jul 2011 13:30:34 +0100 Subject: [PATCH] Added -r option to corelist This will display the release date of a given perl release. If no perl release is specified, will list all perl releases and release dates. --- dist/Module-CoreList/Changes | 3 +++ dist/Module-CoreList/corelist | 33 ++++++++++++++++++++++++++++- dist/Module-CoreList/lib/Module/CoreList.pm | 2 +- pod/perldelta.pod | 5 ++++- 4 files changed, 40 insertions(+), 3 deletions(-) diff --git a/dist/Module-CoreList/Changes b/dist/Module-CoreList/Changes index 89a5d8d..8ae5ace 100644 --- a/dist/Module-CoreList/Changes +++ b/dist/Module-CoreList/Changes @@ -1,3 +1,6 @@ +2.53 Thu Jul 14 2011 + - Added release date option '-r' to corelist + 2.52 Mon Jul 4 2011 - [rt.cpan.org #69108] Extraneous modules listed reported by Dee Newcum diff --git a/dist/Module-CoreList/corelist b/dist/Module-CoreList/corelist index 55ef6ce..d5dac05 100644 --- a/dist/Module-CoreList/corelist +++ b/dist/Module-CoreList/corelist @@ -13,6 +13,7 @@ See L for one. corelist -v corelist [-a|-d] | // [] ... corelist [-v ] [ | // ] ... + corelist [-r ] ... =head1 OPTIONS @@ -96,6 +97,12 @@ like C<5.8.8>.) In module filtering context, it can be used as Perl version filter. +=item -r + +lists all of the perl releases and when they were released + +If you pass a perl version you get the release date for that version only. + =back As a special case, if you specify the module name C, you'll get @@ -112,11 +119,35 @@ use warnings; my %Opts; -GetOptions(\%Opts, qw[ help|?! man! v|version:s a! d ] ); +GetOptions(\%Opts, qw[ help|?! man! r|release:s v|version:s a! d ] ); pod2usage(1) if $Opts{help}; pod2usage(-verbose=>2) if $Opts{man}; +if(exists $Opts{r} ){ + if ( !$Opts{r} ) { + print "\nModule::CoreList has release info for the following perl versions:\n"; + my $versions = { }; + my $max_ver_len = max_mod_len(\%Module::CoreList::released); + for my $ver ( sort keys %Module::CoreList::released ) { + printf "%-${max_ver_len}s %s\n", format_perl_version($ver), $Module::CoreList::released{$ver}; + } + print "\n"; + exit 0; + } + + my $num_r = numify_version( $Opts{r} ); + my $version_hash = Module::CoreList->find_version($num_r); + + if( !$version_hash ) { + print "\nModule::CoreList has no info on perl $Opts{r}\n\n"; + exit 1; + } + + printf "Perl %s was released on %s\n\n", format_perl_version($num_r), $Module::CoreList::released{$num_r}; + exit 0; +} + if(exists $Opts{v} ){ if( !$Opts{v} ) { print "\nModule::CoreList has info on the following perl versions:\n"; diff --git a/dist/Module-CoreList/lib/Module/CoreList.pm b/dist/Module-CoreList/lib/Module/CoreList.pm index 4a5aea2..6706785 100644 --- a/dist/Module-CoreList/lib/Module/CoreList.pm +++ b/dist/Module-CoreList/lib/Module/CoreList.pm @@ -2,7 +2,7 @@ package Module::CoreList; use strict; use vars qw/$VERSION %released %version %families %upstream %bug_tracker %deprecated/; -$VERSION = '2.52'; +$VERSION = '2.53'; =head1 NAME diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 941cdd0..2ac9848 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -292,11 +292,14 @@ performance under ithreads. XXX This will probably be 2.53 for 5.15.1, as there has been a CPAN release of 2.52. -L has been upgraded from version 2.51 to 2.52. +L has been upgraded from version 2.51 to 2.53. Some extraneous (and erroneous) entries have been removed [rt.cpan.org #69108]. +The C utility now understands the C<-r> option for +displaying Perl release dates. + =item * L has been upgraded from version 3.15_05 to 3.15_06. -- 2.7.4