diff options
author | Robin Barker <Robin.Barker@npl.co.uk> | 2009-02-25 09:41:52 +0100 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2009-02-25 09:41:52 +0100 |
commit | c0f08d2c3ac00e3462618e9b7575fa42baf6064b (patch) | |
tree | fd616f94a8d684b775b8213aa7e14ac713b9c27b /lib/deprecate.pm | |
parent | 15e5e8668b86d4e43615103f790f9c1a736045dd (diff) | |
download | perl-c0f08d2c3ac00e3462618e9b7575fa42baf6064b.tar.gz |
test script for deprecate.pm
First pass at tests for deprecate.pm.
Had to modify the module to provide an interface for testing - need to
provide fake install directories, but deprecated reads from
%Config::Config, which is read only.
Diffstat (limited to 'lib/deprecate.pm')
-rw-r--r-- | lib/deprecate.pm | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/deprecate.pm b/lib/deprecate.pm index 068c1b9564..e33d8c5c92 100644 --- a/lib/deprecate.pm +++ b/lib/deprecate.pm @@ -1,12 +1,12 @@ -#!perl -w -use strict; - package deprecate; -use Config; -use Carp; +use strict; use warnings; our $VERSION = 0.01; +# our %Config can ignore %Config::Config, e.g. for testing +our %Config; +unless (%Config) { require Config; *Config = \%Config::Config; } + sub import { my ($package, $file, $line) = caller; my $expect_leaf = "$package.pm"; @@ -42,7 +42,7 @@ EOM && (vec($callers_bitmask, $warnings::Offsets{deprecated}, 1) || vec($callers_bitmask, $warnings::Offsets{all}, 1))) { warn <<"EOM"; -$package will be removed from the Perl core distribution in the next major release. Please install it from CPAN. It is being used at $call_file line $call_line +$package will be removed from the Perl core distribution in the next major release. Please install it from CPAN. It is being used at $call_file, line $call_line. EOM } return; |