Debian Codegraph @

upstream/mageia-cauldron/man3pm/deprecate.3pm

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\"
56 .\" Required to disable full justification in groff 1.23.0.
57 .if n .ds AD l
58 .\" ========================================================================
59 .\"
60 .IX Title "deprecate 3pm"
61 .TH deprecate 3pm 2023-12-22 "perl v5.42.0" "Perl Programmers Reference Guide"
62 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
63 .\" way too many mistakes in technical documents.
64 .if n .ad l
65 .nh
66 .SH NAME
67 deprecate \- Perl pragma for deprecating the inclusion of a module in core
68 .SH SYNOPSIS
69 .IX Header "SYNOPSIS"
70 .Vb 1
71 \& use deprecate; # warn about future absence if loaded from core
72 .Ve
73 .SH DESCRIPTION
74 .IX Header "DESCRIPTION"
75 This pragma simplifies the maintenance of dual\-life modules that will no longer
76 be included in the Perl core in a future Perl release, but are still included
77 currently.
78 .PP
79 The purpose of the pragma is to alert users to the status of such a module by
80 issuing a warning that encourages them to install the module from CPAN, so that
81 a future upgrade to a perl which omits the module will not break their code.
82 .PP
83 This warning will only be issued if the module was loaded from a core library
84 directory, which allows the \f(CW\*(C`use deprecate\*(C'\fR line to be included in the CPAN
85 version of the module. Because the pragma remains silent when the module is run
86 from a non\-core library directory, the pragma call does not need to be patched
87 into or out of either the core or CPAN version of the module. The exact same
88 code can be shipped for either purpose.
89 .SS "Important Caveat"
90 .IX Subsection "Important Caveat"
91 Note that when a module installs from CPAN to a core library directory rather
92 than the site library directories, the user gains no protection from having
93 installed it.
94 .PP
95 At the same time, this pragma cannot detect when such a module has installed
96 from CPAN to the core library, and so it would endlessly and uselessly exhort
97 the user to upgrade.
98 .PP
99 Therefore modules that can install from CPAN to the core library must make sure
100 not to call this pragma when they have done so. Generally this means that the
101 exact logic from the installer must be mirrored inside the module. E.g.:
102 .PP
103 .Vb 5
104 \& # Makefile.PL
105 \& WriteMakefile(
106 \& # ...
107 \& INSTALLDIRS => ( "$]" >= 5.011 ? \*(Aqsite\*(Aq : \*(Aqperl\*(Aq ),
108 \& );
109 \&
110 \& # lib/Foo/Bar.pm
111 \& use if "$]" >= 5.011, \*(Aqdeprecate\*(Aq;
112 .Ve
113 .PP
114 (The above example shows the most important case of this: when the target is
115 a Perl older than 5.12 (where the core library directories take precedence over
116 the site library directories) and the module being installed was included in
117 core in that Perl version. Under those circumstances, an upgrade of the module
118 from CPAN is only possible by installing to the core library.)
119 .SH EXPORT
120 .IX Header "EXPORT"
121 None by default. The only method is \f(CW\*(C`import\*(C'\fR, called by \f(CW\*(C`use deprecate;\*(C'\fR.
122 .SH "SEE ALSO"
123 .IX Header "SEE ALSO"
124 First example to \f(CW\*(C`use deprecate;\*(C'\fR was Switch.
125 .SH AUTHOR
126 .IX Header "AUTHOR"
127 Original version by Nicholas Clark
128 .SH "COPYRIGHT AND LICENSE"
129 .IX Header "COPYRIGHT AND LICENSE"
130 Copyright (C) 2009, 2011
131 .PP
132 This library is free software; you can redistribute it and/or modify
133 it under the same terms as Perl itself, either Perl version 5.10.0 or,
134 at your option, any later version of Perl 5 you may have available.