In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/117c08bff362aadf9f1826edcf50f7b0bebeba10?hp=5ad96e9e32a29f927d3e9dec23fd1d7d3e89665f>
- Log ----------------------------------------------------------------- commit 117c08bff362aadf9f1826edcf50f7b0bebeba10 Author: Thomas Sibley <tsib...@cpan.org> Date: Tue Jun 6 13:11:58 2017 +0100 [PATCH] corelist: Provide access to info on utilities via Module::CoreList::Utils Signed-off-by: Chris 'BinGOs' Williams <ch...@bingosnet.co.uk> ----------------------------------------------------------------------- Summary of changes: dist/Module-CoreList/corelist | 79 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/dist/Module-CoreList/corelist b/dist/Module-CoreList/corelist index 9f3d335ad7..3d2706a829 100644 --- a/dist/Module-CoreList/corelist +++ b/dist/Module-CoreList/corelist @@ -14,6 +14,8 @@ See L<Module::CoreList> for one. corelist [-a|-d] <ModuleName> | /<ModuleRegex>/ [<ModuleVersion>] ... corelist [-v <PerlVersion>] [ <ModuleName> | /<ModuleRegex>/ ] ... corelist [-r <PerlVersion>] ... + corelist --utils [-d] <UtilityName> [<UtilityName>] ... + corelist --utils -v <PerlVersion> corelist --feature <FeatureName> [<FeatureName>] ... corelist --diff PerlVersion PerlVersion corelist --upstream <ModuleName> @@ -113,6 +115,15 @@ 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. +=item --utils + +lists the first version of perl each named utility program was released with + +May be used with -d to modify the first release criteria. + +If used with -v <version> then all utilities released with that version of perl +are listed, and any utility programs named on the command line are ignored. + =item --feature, -f lists the first version bundle of each named feature given @@ -142,7 +153,7 @@ my %Opts; GetOptions( \%Opts, - qw[ help|?! man! r|release:s v|version:s a! d diff|D feature|f u|upstream ] + qw[ help|?! man! r|release:s v|version:s a! d diff|D utils feature|f u|upstream ] ); pod2usage(1) if $Opts{help}; @@ -181,6 +192,12 @@ if(exists $Opts{v} ){ } my $num_v = numify_version( $Opts{v} ); + + if ($Opts{utils}) { + utilities_in_version($num_v); + exit 0; + } + my $version_hash = Module::CoreList->find_version($num_v); if( !$version_hash ) { @@ -227,6 +244,25 @@ if ($Opts{diff}) { exit(0); } +if ($Opts{utils}) { + die "\n--utils only available with perl v5.19.1 or greater\n" + if $] < 5.019001; + + die "\nprovide at least one utility name to --utils\n" + unless @ARGV; + + warn "\n-a has no effect when --utils is used\n" if $Opts{a}; + warn "\n--diff has no effect when --utils is used\n" if $Opts{diff}; + warn "\n--upstream, or -u, has no effect when --utils is used\n" if $Opts{u}; + + my $when = maxstr(values %Module::CoreList::released); + print "\n","Data for $when\n"; + + utility_version($_) for @ARGV; + + exit(0); +} + if ($Opts{feature}) { die "\n--feature is only available with perl v5.16.0 or greater\n" if $] < 5.016; @@ -364,6 +400,47 @@ sub module_version { } } +sub utility_version { + my ($utility) = @_; + + require Module::CoreList::Utils; + + my $released = $Opts{d} + ? Module::CoreList::Utils->first_release_by_date($utility) + : Module::CoreList::Utils->first_release($utility); + + my $removed = $Opts{d} + ? Module::CoreList::Utils->removed_from_by_date($utility) + : Module::CoreList::Utils->removed_from($utility); + + if ($released) { + print "$utility was first released with perl ", format_perl_version($released); + print " and later removed in ", format_perl_version($removed) + if $removed; + print "\n"; + } else { + print "$utility was not in CORE (or so I think)\n"; + } +} + +sub utilities_in_version { + my ($version) = @_; + + require Module::CoreList::Utils; + + my @utilities = Module::CoreList::Utils->utilities($version); + + if (not @utilities) { + print "\nModule::CoreList::Utils has no info on perl $version\n\n"; + exit 1; + } + + print "\nThe following utilities were in perl ", + format_perl_version($version), " CORE\n"; + print "$_\n" for sort { lc($a) cmp lc($b) } @utilities; + print "\n"; +} + sub max_mod_len { my $versions = shift; -- Perl5 Master Repository