Debian Codegraph @

upstream/debian-unstable/man3/deprecate.3perl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (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 .\"
57 .IX Title "deprecate 3perl"
58 .TH deprecate 3perl 2025-11-16 "perl v5.40.1" "Perl Programmers Reference Guide"
59 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
60 .\" way too many mistakes in technical documents.
61 .if n .ad l
62 .nh
63 .SH NAME
64 deprecate \- Perl pragma for deprecating the inclusion of a module in core
65 .SH SYNOPSIS
66 .IX Header "SYNOPSIS"
67 .Vb 1
68 \& use deprecate; # warn about future absence if loaded from core
69 .Ve
70 .SH DESCRIPTION
71 .IX Header "DESCRIPTION"
72 This pragma simplifies the maintenance of dual-life modules that will no longer
73 be included in the Perl core in a future Perl release, but are still included
74 currently.
75 .PP
76 The purpose of the pragma is to alert users to the status of such a module by
77 issuing a warning that encourages them to install the module from CPAN, so that
78 a future upgrade to a perl which omits the module will not break their code.
79 .PP
80 This warning will only be issued if the module was loaded from a core library
81 directory, which allows the \f(CW\*(C`use deprecate\*(C'\fR line to be included in the CPAN
82 version of the module. Because the pragma remains silent when the module is run
83 from a non-core library directory, the pragma call does not need to be patched
84 into or out of either the core or CPAN version of the module. The exact same
85 code can be shipped for either purpose.
86 .SS "Important Caveat"
87 .IX Subsection "Important Caveat"
88 Note that when a module installs from CPAN to a core library directory rather
89 than the site library directories, the user gains no protection from having
90 installed it.
91 .PP
92 At the same time, this pragma cannot detect when such a module has installed
93 from CPAN to the core library, and so it would endlessly and uselessly exhort
94 the user to upgrade.
95 .PP
96 Therefore modules that can install from CPAN to the core library must make sure
97 not to call this pragma when they have done so. Generally this means that the
98 exact logic from the installer must be mirrored inside the module. E.g.:
99 .PP
100 .Vb 5
101 \& # Makefile.PL
102 \& WriteMakefile(
103 \& # ...
104 \& INSTALLDIRS => ( "$]" >= 5.011 ? \*(Aqsite\*(Aq : \*(Aqperl\*(Aq ),
105 \& );
106 \&
107 \& # lib/Foo/Bar.pm
108 \& use if "$]" >= 5.011, \*(Aqdeprecate\*(Aq;
109 .Ve
110 .PP
111 (The above example shows the most important case of this: when the target is
112 a Perl older than 5.12 (where the core library directories take precedence over
113 the site library directories) and the module being installed was included in
114 core in that Perl version. Under those circumstances, an upgrade of the module
115 from CPAN is only possible by installing to the core library.)
116 .SH EXPORT
117 .IX Header "EXPORT"
118 None by default. The only method is \f(CW\*(C`import\*(C'\fR, called by \f(CW\*(C`use deprecate;\*(C'\fR.
119 .SH "SEE ALSO"
120 .IX Header "SEE ALSO"
121 First example to \f(CW\*(C`use deprecate;\*(C'\fR was Switch.
122 .SH AUTHOR
123 .IX Header "AUTHOR"
124 Original version by Nicholas Clark
125 .SH "COPYRIGHT AND LICENSE"
126 .IX Header "COPYRIGHT AND LICENSE"
127 Copyright (C) 2009, 2011
128 .PP
129 This library is free software; you can redistribute it and/or modify
130 it under the same terms as Perl itself, either Perl version 5.10.0 or,
131 at your option, any later version of Perl 5 you may have available.