summaryrefslogtreecommitdiff
path: root/dist
diff options
context:
space:
mode:
authorChris Williams <chris@bingosnet.co.uk>2009-10-21 00:01:18 +0100
committerChris Williams <chris@bingosnet.co.uk>2009-10-21 00:01:18 +0100
commitc77945c3ac1accefe435a4ba5074a4f9257b4bf9 (patch)
tree70417e350809c986289afbfd196b9400e91997df /dist
parentd5bddf6e73535489e587a205e0bfbe9b86aff43f (diff)
downloadperl-c77945c3ac1accefe435a4ba5074a4f9257b4bf9.tar.gz
Module::CoreList, implemented is_deprecated() and added tests for it.
Module::CoreList->is_deprecated( 'Switch' ); # assumes $] Module::CoreList->is_deprecated( 'Switch', 5.01000 );
Diffstat (limited to 'dist')
-rw-r--r--dist/Module-CoreList/MANIFEST1
-rw-r--r--dist/Module-CoreList/lib/Module/CoreList.pm16
-rw-r--r--dist/Module-CoreList/t/deprecated.t8
3 files changed, 23 insertions, 2 deletions
diff --git a/dist/Module-CoreList/MANIFEST b/dist/Module-CoreList/MANIFEST
index 0afea85550..bbf88df3f2 100644
--- a/dist/Module-CoreList/MANIFEST
+++ b/dist/Module-CoreList/MANIFEST
@@ -7,5 +7,6 @@ MANIFEST
Makefile.PL
META.yml
t/corelist.t
+t/deprecated.t
t/find_modules.t
t/pod.t
diff --git a/dist/Module-CoreList/lib/Module/CoreList.pm b/dist/Module-CoreList/lib/Module/CoreList.pm
index 029ee3d9e0..f5ccf0e143 100644
--- a/dist/Module-CoreList/lib/Module/CoreList.pm
+++ b/dist/Module-CoreList/lib/Module/CoreList.pm
@@ -1,8 +1,8 @@
package Module::CoreList;
use strict;
use vars qw/$VERSION %released %version %families %upstream
- %bug_tracker/;
-$VERSION = '2.21';
+ %bug_tracker %deprecated/;
+$VERSION = '2.22';
=head1 NAME
@@ -138,6 +138,14 @@ sub find_version {
return undef;
}
+sub is_deprecated {
+ my ($discard, $module, $perl) = @_;
+ return unless $module and exists $deprecated{ $module };
+ $perl = $] unless $perl and exists $version{ $perl };
+ return $deprecated{ $module } if
+ $perl >= $deprecated{ $module };
+}
+
# When things escaped.
# NB. If you put version numbers with trailing zeroes here, you
# should also add an alias for the numerical ($]) version; see
@@ -11848,6 +11856,10 @@ for my $version ( sort { $a <=> $b } keys %released ) {
'version' => undef,
);
+# Deprecated modules and the version they were deprecated
+%deprecated = (
+ 'Switch' => '5.011',
+);
# Create aliases with trailing zeros for $] use
diff --git a/dist/Module-CoreList/t/deprecated.t b/dist/Module-CoreList/t/deprecated.t
new file mode 100644
index 0000000000..151b6c081a
--- /dev/null
+++ b/dist/Module-CoreList/t/deprecated.t
@@ -0,0 +1,8 @@
+#!perl -w
+use strict;
+use Module::CoreList;
+use Test::More tests => 3;
+
+is(Module::CoreList->is_deprecated('Switch',5.011),'5.011','Switch is deprecated');
+is(Module::CoreList->is_deprecated('Switch',5.011000),'5.011','Switch is deprecated using $]');
+is(Module::CoreList->is_deprecated('Switch',5.010),'','Switch is not deprecated');