1deprecate(3pm)         Perl Programmers Reference Guide         deprecate(3pm)
2
3
4

NAME

6       deprecate - Perl pragma for deprecating the inclusion of a module in
7       core
8

SYNOPSIS

10           use deprecate;  # warn about future absence if loaded from core
11

DESCRIPTION

13       This pragma simplifies the maintenance of dual-life modules that will
14       no longer be included in the Perl core in a future Perl release, but
15       are still included currently.
16
17       The purpose of the pragma is to alert users to the status of such a
18       module by issuing a warning that encourages them to install the module
19       from CPAN, so that a future upgrade to a perl which omits the module
20       will not break their code.
21
22       This warning will only be issued if the module was loaded from a core
23       library directory, which allows the "use deprecate" line to be included
24       in the CPAN version of the module. Because the pragma remains silent
25       when the module is run from a non-core library directory, the pragma
26       call does not need to be patched into or out of either the core or CPAN
27       version of the module. The exact same code can be shipped for either
28       purpose.
29
30   Important Caveat
31       Note that when a module installs from CPAN to a core library directory
32       rather than the site library directories, the user gains no protection
33       from having installed it.
34
35       At the same time, this pragma cannot detect when such a module has
36       installed from CPAN to the core library, and so it would endlessly and
37       uselessly exhort the user to upgrade.
38
39       Therefore modules that can install from CPAN to the core library must
40       make sure not to call this pragma when they have done so. Generally
41       this means that the exact logic from the installer must be mirrored
42       inside the module. E.g.:
43
44           # Makefile.PL
45           WriteMakefile(
46               # ...
47               INSTALLDIRS => ( "$]" >= 5.011 ? 'site' : 'perl' ),
48           );
49
50           # lib/Foo/Bar.pm
51           use if "$]" >= 5.011, 'deprecate';
52
53       (The above example shows the most important case of this: when the
54       target is a Perl older than 5.12 (where the core library directories
55       take precedence over the site library directories) and the module being
56       installed was included in core in that Perl version. Under those
57       circumstances, an upgrade of the module from CPAN is only possible by
58       installing to the core library.)
59

EXPORT

61       None by default.  The only method is "import", called by "use
62       deprecate;".
63

SEE ALSO

65       First example to "use deprecate;" was Switch.
66

AUTHOR

68       Original version by Nicholas Clark
69
71       Copyright (C) 2009, 2011
72
73       This library is free software; you can redistribute it and/or modify it
74       under the same terms as Perl itself, either Perl version 5.10.0 or, at
75       your option, any later version of Perl 5 you may have available.
76
77
78
79perl v5.30.2                      2020-03-27                    deprecate(3pm)
Impressum