line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#line 1 |
2
|
4
|
|
|
4
|
|
27
|
package deprecate; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
122
|
|
3
|
4
|
|
|
4
|
|
21
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
2523
|
|
4
|
|
|
|
|
|
|
use warnings; |
5
|
|
|
|
|
|
|
our $VERSION = 0.03; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# our %Config can ignore %Config::Config, e.g. for testing |
8
|
|
|
|
|
|
|
our %Config; |
9
|
|
|
|
|
|
|
unless (%Config) { require Config; *Config = \%Config::Config; } |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Debian-specific change: recommend the separate Debian packages of |
12
|
|
|
|
|
|
|
# deprecated modules where available |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our %DEBIAN_PACKAGES = ( |
15
|
|
|
|
|
|
|
# None for the perl 5.22 cycle |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# This isn't a public API. It's internal to code maintained by the perl-porters |
19
|
|
|
|
|
|
|
# If you would like it to be a public API, please send a patch with |
20
|
|
|
|
|
|
|
# documentation and tests. Until then, it may change without warning. |
21
|
12
|
|
|
12
|
|
28
|
sub __loaded_from_core { |
22
|
|
|
|
|
|
|
my ($package, $file, $expect_leaf) = @_; |
23
|
12
|
|
|
|
|
40
|
|
24
|
|
|
|
|
|
|
foreach my $pair ([qw(sitearchexp archlibexp)], |
25
|
24
|
|
|
|
|
253
|
[qw(sitelibexp privlibexp)]) { |
26
|
24
|
50
|
|
|
|
101
|
my ($site, $priv) = @Config{@$pair}; |
27
|
0
|
|
|
|
|
0
|
if ($^O eq 'VMS') { |
|
0
|
|
|
|
|
0
|
|
28
|
|
|
|
|
|
|
for my $d ($site, $priv) { $d = VMS::Filespec::unixify($d) }; |
29
|
|
|
|
|
|
|
} |
30
|
24
|
|
|
|
|
358
|
# Just in case anyone managed to configure with trailing /s |
31
|
|
|
|
|
|
|
s!/*$!!g foreach $site, $priv; |
32
|
24
|
50
|
|
|
|
59
|
|
33
|
24
|
50
|
|
|
|
91
|
next if $site eq $priv; |
34
|
0
|
|
|
|
|
0
|
if (uc("$priv/$expect_leaf") eq uc($file)) { |
35
|
|
|
|
|
|
|
return 1; |
36
|
|
|
|
|
|
|
} |
37
|
12
|
|
|
|
|
2180
|
} |
38
|
|
|
|
|
|
|
return 0; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
12
|
|
|
12
|
|
56
|
sub import { |
42
|
|
|
|
|
|
|
my ($package, $file) = caller; |
43
|
12
|
|
|
|
|
34
|
|
44
|
12
|
|
|
|
|
50
|
my $expect_leaf = "$package.pm"; |
45
|
|
|
|
|
|
|
$expect_leaf =~ s!::!/!g; |
46
|
12
|
50
|
|
|
|
36
|
|
47
|
0
|
|
|
|
|
|
if (__loaded_from_core($package, $file, $expect_leaf)) { |
48
|
0
|
|
|
|
|
|
my $call_depth=1; |
49
|
0
|
|
|
|
|
|
my @caller; |
50
|
0
|
0
|
0
|
|
|
|
while (@caller = caller $call_depth++) { |
51
|
|
|
|
|
|
|
last if $caller[7] # use/require |
52
|
|
|
|
|
|
|
and $caller[6] eq $expect_leaf; # the package file |
53
|
0
|
0
|
|
|
|
|
} |
54
|
0
|
|
|
|
|
|
unless (@caller) { |
55
|
0
|
|
|
|
|
|
require Carp; |
56
|
|
|
|
|
|
|
Carp::cluck(<<"EOM"); |
57
|
|
|
|
|
|
|
Can't find use/require $expect_leaf in caller stack |
58
|
0
|
|
|
|
|
|
EOM |
59
|
|
|
|
|
|
|
return; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# This is fragile, because it |
63
|
0
|
|
|
|
|
|
# is directly poking in the internals of warnings.pm |
64
|
|
|
|
|
|
|
my ($call_file, $call_line, $callers_bitmask) = @caller[1,2,9]; |
65
|
0
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
66
|
|
|
|
|
|
|
if (defined $callers_bitmask |
67
|
|
|
|
|
|
|
&& (vec($callers_bitmask, $warnings::Offsets{deprecated}, 1) |
68
|
0
|
0
|
|
|
|
|
|| vec($callers_bitmask, $warnings::Offsets{all}, 1))) { |
69
|
0
|
|
|
|
|
|
if (my $deb = $DEBIAN_PACKAGES{$package}) { |
70
|
|
|
|
|
|
|
warn <<"EOM"; |
71
|
|
|
|
|
|
|
$package will be removed from the Perl core distribution in the next major release. Please install the separate $deb package. It is being used at $call_file, line $call_line. |
72
|
|
|
|
|
|
|
EOM |
73
|
0
|
|
|
|
|
|
} else { |
74
|
|
|
|
|
|
|
warn <<"EOM"; |
75
|
|
|
|
|
|
|
$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. |
76
|
|
|
|
|
|
|
EOM |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
__END__ |