In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/c77945c3ac1accefe435a4ba5074a4f9257b4bf9?hp=d5bddf6e73535489e587a205e0bfbe9b86aff43f>

- Log -----------------------------------------------------------------
commit c77945c3ac1accefe435a4ba5074a4f9257b4bf9
Author: Chris Williams <[email protected]>
Date:   Wed Oct 21 00:01:18 2009 +0100

    Module::CoreList, implemented is_deprecated() and added tests for it.
    
      Module::CoreList->is_deprecated( 'Switch' ); # assumes $]
    
      Module::CoreList->is_deprecated( 'Switch', 5.01000 );
-----------------------------------------------------------------------

Summary of changes:
 MANIFEST                                    |    1 +
 dist/Module-CoreList/MANIFEST               |    1 +
 dist/Module-CoreList/lib/Module/CoreList.pm |   16 ++++++++++++++--
 dist/Module-CoreList/t/deprecated.t         |    8 ++++++++
 4 files changed, 24 insertions(+), 2 deletions(-)
 create mode 100644 dist/Module-CoreList/t/deprecated.t

diff --git a/MANIFEST b/MANIFEST
index 7d247df..3aad396 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -2687,6 +2687,7 @@ dist/Module-CoreList/MANIFEST                     
Module::CoreList
 dist/Module-CoreList/META.yml                  Module::CoreList
 dist/Module-CoreList/README                    Module::CoreList
 dist/Module-CoreList/t/corelist.t              Module::CoreList tests
+dist/Module-CoreList/t/deprecated.t            Module::CoreList tests
 dist/Module-CoreList/t/find_modules.t          Module::CoreList tests
 dist/Module-CoreList/t/pod.t                   Module::CoreList tests
 dist/Net-Ping/Changes                  Net::Ping
diff --git a/dist/Module-CoreList/MANIFEST b/dist/Module-CoreList/MANIFEST
index 0afea85..bbf88df 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 029ee3d..f5ccf0e 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 0000000..151b6c0
--- /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');

--
Perl5 Master Repository

Reply via email to