in the order of perl version numbers. If you want to get the earliest
perl release instead, use Module::CoreList::first_release_by_date().
+New in 2.22, Module::CoreList::deprecated(MODULE,PERL_VERSION) returns true
+if MODULE is marked as deprecated in PERL_VERSION. If PERL_VERSION is
+omitted, it defaults to the current version of Perl.
+
=head1 CAVEATS
Module::CoreList currently covers the 5.000, 5.001, 5.002, 5.003_07, 5.004,
}
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 };
+ my ($module, $perl_version) = @_;
+ $perl_version ||= $];
+ return unless $module && exists $deprecated{$perl_version}{$module};
+ return $deprecated{$perl_version}{$module};
}
# When things escaped.
'version' => undef,
);
-# Deprecated modules and the version they were deprecated
-%deprecated = (
- 'Switch' => '5.011',
-);
-
# Create aliases with trailing zeros for $] use
$released{'5.000'} = $released{5};
#!perl -w
use strict;
-use Module::CoreList;
-use Test::More tests => 3;
+use Test::More tests => 7;
-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');
+require_ok('Module::CoreList');
+
+ok($Module::CoreList::deprecated{5.011000}, "5.011000 (deprecated list)");
+
+ok(!exists $Module::CoreList::deprecated{5.011000}{'File::Spec'},
+ "File::Spec not deprecated in 5.011000 (hash)"
+);
+
+ok(! Module::CoreList::is_deprecated('File::Spec'),
+ "File::Spec not deprecated in 5.011000 (function)"
+);
+
+ok(exists $Module::CoreList::deprecated{5.011000}{'Switch'},
+ "Switch deprecated in 5.011000 (hash)"
+);
+
+is(!! Module::CoreList::is_deprecated('Switch'), !! $] >= 5.011,
+ "Switch deprecated current perl (function)"
+);
+
+ok(! Module::CoreList::is_deprecated('Switch', 5.010000),
+ "Switch not deprecated in 5.010000 (function w/ perl version)"
+);