.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "deprecate 3pm" .TH deprecate 3pm 2023-11-28 "perl v5.38.2" "Perl Programmers Reference Guide" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME deprecate \- Perl pragma for deprecating the inclusion of a module in core .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use deprecate; # warn about future absence if loaded from core .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This pragma simplifies the maintenance of dual-life modules that will no longer be included in the Perl core in a future Perl release, but are still included currently. .PP The purpose of the pragma is to alert users to the status of such a module by issuing a warning that encourages them to install the module from CPAN, so that a future upgrade to a perl which omits the module will not break their code. .PP This warning will only be issued if the module was loaded from a core library directory, which allows the \f(CW\*(C`use deprecate\*(C'\fR line to be included in the CPAN version of the module. Because the pragma remains silent when the module is run from a non-core library directory, the pragma call does not need to be patched into or out of either the core or CPAN version of the module. The exact same code can be shipped for either purpose. .SS "Important Caveat" .IX Subsection "Important Caveat" Note that when a module installs from CPAN to a core library directory rather than the site library directories, the user gains no protection from having installed it. .PP At the same time, this pragma cannot detect when such a module has installed from CPAN to the core library, and so it would endlessly and uselessly exhort the user to upgrade. .PP Therefore modules that can install from CPAN to the core library must make sure not to call this pragma when they have done so. Generally this means that the exact logic from the installer must be mirrored inside the module. E.g.: .PP .Vb 5 \& # Makefile.PL \& WriteMakefile( \& # ... \& INSTALLDIRS => ( "$]" >= 5.011 ? \*(Aqsite\*(Aq : \*(Aqperl\*(Aq ), \& ); \& \& # lib/Foo/Bar.pm \& use if "$]" >= 5.011, \*(Aqdeprecate\*(Aq; .Ve .PP (The above example shows the most important case of this: when the target is a Perl older than 5.12 (where the core library directories take precedence over the site library directories) and the module being installed was included in core in that Perl version. Under those circumstances, an upgrade of the module from CPAN is only possible by installing to the core library.) .SH EXPORT .IX Header "EXPORT" None by default. The only method is \f(CW\*(C`import\*(C'\fR, called by \f(CW\*(C`use deprecate;\*(C'\fR. .SH "SEE ALSO" .IX Header "SEE ALSO" First example to \f(CW\*(C`use deprecate;\*(C'\fR was Switch. .SH AUTHOR .IX Header "AUTHOR" Original version by Nicholas Clark .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (C) 2009, 2011 .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.