6 # our %Config can ignore %Config::Config, e.g. for testing
8 unless (%Config) { require Config; *Config = \%Config::Config; }
10 # This isn't a public API. It's internal to code maintained by the perl-porters
11 # If you would like it to be a public API, please send a patch with
12 # documentation and tests. Until then, it may change without warning.
13 sub __loaded_from_core {
14 my ($package, $file, $expect_leaf) = @_;
16 foreach my $pair ([qw(sitearchexp archlibexp)],
17 [qw(sitelibexp privlibexp)]) {
18 my ($site, $priv) = @Config{@$pair};
20 for my $d ($site, $priv) { $d = VMS::Filespec::unixify($d) };
22 # Just in case anyone managed to configure with trailing /s
23 s!/*$!!g foreach $site, $priv;
25 next if $site eq $priv;
26 if (uc("$priv/$expect_leaf") eq uc($file)) {
34 my ($package, $file) = caller;
36 my $expect_leaf = "$package.pm";
37 $expect_leaf =~ s!::!/!g;
39 if (__loaded_from_core($package, $file, $expect_leaf)) {
42 while (@caller = caller $call_depth++) {
43 last if $caller[7] # use/require
44 and $caller[6] eq $expect_leaf; # the package file
49 Can't find use/require $expect_leaf in caller stack
54 # This is fragile, because it
55 # is directly poking in the internals of warnings.pm
56 my ($call_file, $call_line, $callers_bitmask) = @caller[1,2,9];
58 if (defined $callers_bitmask
59 && (vec($callers_bitmask, $warnings::Offsets{deprecated}, 1)
60 || vec($callers_bitmask, $warnings::Offsets{all}, 1))) {
62 $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.
74 deprecate - Perl pragma for deprecating the core version of a module
78 use deprecate; # always deprecate the module in which this occurs
80 use if $] > 5.010, 'deprecate'; # conditionally deprecate the module
85 This module is used using C<use deprecate;> (or something that calls
86 C<< deprecate->import() >>, for example C<use if COND, deprecate;>).
88 If the module that includes C<use deprecate> is located in a core library
89 directory, a deprecation warning is issued, encouraging the user to use
90 the version on CPAN. If that module is located in a site library, it is
91 the CPAN version, and no warning is issued.
95 None by default. The only method is C<import>, called by C<use deprecate;>.
100 First example to C<use deprecate;> was L<Switch>.
105 Original version by Nicholas Clark
108 =head1 COPYRIGHT AND LICENSE
110 Copyright (C) 2009, 2011
112 This library is free software; you can redistribute it and/or modify
113 it under the same terms as Perl itself, either Perl version 5.10.0 or,
114 at your option, any later version of Perl 5 you may have available.