summaryrefslogtreecommitdiff
path: root/dist
diff options
context:
space:
mode:
authorAlexandr Ciornii <alexchorny@gmail.com>2012-10-31 12:31:47 +0200
committerFather Chrysostomos <sprout@cpan.org>2012-11-02 13:15:53 -0700
commit10526356e664e201db9ef971ea753a75699ebe37 (patch)
tree2367899c1ba4294976b0a425da7b7fb9a30d7771 /dist
parentd861347ee4d008eefde849f3419e6016bb2c677f (diff)
downloadperl-10526356e664e201db9ef971ea753a75699ebe37.tar.gz
print deprecation information in corelist
Diffstat (limited to 'dist')
-rw-r--r--dist/Module-CoreList/Makefile.PL3
-rw-r--r--dist/Module-CoreList/corelist8
-rw-r--r--dist/Module-CoreList/lib/Module/CoreList.pm11
-rw-r--r--dist/Module-CoreList/t/deprecated.t12
4 files changed, 30 insertions, 4 deletions
diff --git a/dist/Module-CoreList/Makefile.PL b/dist/Module-CoreList/Makefile.PL
index 3fd5f61706..6235c47449 100644
--- a/dist/Module-CoreList/Makefile.PL
+++ b/dist/Module-CoreList/Makefile.PL
@@ -9,7 +9,8 @@ WriteMakefile
'VERSION_FROM' => 'lib/Module/CoreList.pm',
'ABSTRACT_FROM' => 'lib/Module/CoreList.pod',
'PREREQ_PM' => {
- 'Test::More' => '0',
+ 'Test::More' => '0',
+ 'List::Util' => 0,
},
'EXE_FILES' => [ _scripts() ],
'PL_FILES' => {},
diff --git a/dist/Module-CoreList/corelist b/dist/Module-CoreList/corelist
index 9cd0e8f21f..8842e134dd 100644
--- a/dist/Module-CoreList/corelist
+++ b/dist/Module-CoreList/corelist
@@ -124,6 +124,7 @@ use Getopt::Long;
use Pod::Usage;
use strict;
use warnings;
+use List::Util qw/maxstr/;
my %Opts;
@@ -275,16 +276,21 @@ sub module_version {
? Module::CoreList->removed_from_by_date($mod)
: Module::CoreList->removed_from($mod);
+ my $when = maxstr(values %Module::CoreList::released);
+ print "\n","Data for $when\n";
+
if( defined $ret ) {
+ my $deprecated = Module::CoreList->deprecated_in($mod);
$msg .= " was ";
$msg .= "first " unless $ver;
$msg .= "released with perl " . format_perl_version($ret);
+ $msg .= ( $rem ? ',' : ' and' ) . " deprecated in " . format_perl_version($deprecated) if $deprecated;
$msg .= " and removed from " . format_perl_version($rem) if $rem;
} else {
$msg .= " was not in CORE (or so I think)";
}
- print "\n",$msg,"\n";
+ print $msg,"\n";
if(defined $ret and exists $Opts{a} and $Opts{a}){
display_a($mod);
diff --git a/dist/Module-CoreList/lib/Module/CoreList.pm b/dist/Module-CoreList/lib/Module/CoreList.pm
index d87f4b59de..7bc48eb05e 100644
--- a/dist/Module-CoreList/lib/Module/CoreList.pm
+++ b/dist/Module-CoreList/lib/Module/CoreList.pm
@@ -78,6 +78,17 @@ sub is_deprecated {
return $deprecated{$perl_version}{$module};
}
+sub deprecated_in {
+ my $module = shift;
+ $module = shift if eval { $module->isa(__PACKAGE__) }
+ and scalar @_ and $_[0] =~ m#\A[a-zA-Z_][0-9a-zA-Z_]*(?:(::|')[0-9a-zA-Z_]+)*\z#;
+ return unless $module;
+ my @perls = grep { exists $deprecated{$_}{$module} } keys %deprecated;
+ return unless @perls;
+ require List::Util;
+ return List::Util::min(@perls);
+}
+
sub removed_from {
my @perls = &removed_raw;
return shift @perls;
diff --git a/dist/Module-CoreList/t/deprecated.t b/dist/Module-CoreList/t/deprecated.t
index 00df561a75..020738f088 100644
--- a/dist/Module-CoreList/t/deprecated.t
+++ b/dist/Module-CoreList/t/deprecated.t
@@ -1,6 +1,6 @@
#!perl -w
use strict;
-use Test::More tests => 7;
+use Test::More tests => 9;
require_ok('Module::CoreList');
@@ -11,7 +11,7 @@ ok(!exists $Module::CoreList::deprecated{5.011000}{'File::Spec'},
);
ok(! Module::CoreList::is_deprecated('File::Spec'),
- "File::Spec not deprecated in 5.011000 (function)"
+ "File::Spec currently is not deprecated (function)"
);
ok(exists $Module::CoreList::deprecated{5.011000}{'Switch'},
@@ -25,3 +25,11 @@ is(!! Module::CoreList::is_deprecated('Switch'), !! ($] >= 5.011 and $] < 5.0130
ok(! Module::CoreList::is_deprecated('Switch', 5.010000),
"Switch not deprecated in 5.010000 (function w/ perl version)"
);
+
+is(Module::CoreList::deprecated_in('Switch'), 5.011000,
+ "Switch was deprecated in 5.011000 (deprecated_in)"
+);
+
+ok(! Module::CoreList::deprecated_in('File::Spec'),
+ "File::Spec currently is not deprecated (deprecated_in)"
+);