Commit | Line | Data |
---|---|---|
9021a1cf A |
1 | =head1 NAME |
2 | ||
3 | perldeprecation - list Perl deprecations | |
4 | ||
5 | =head1 DESCRIPTION | |
6 | ||
7 | The purpose of this document is to document what has been deprecated | |
8 | in Perl, and by which version the deprecated feature will disappear, | |
9 | or, for already removed features, when it was removed. | |
10 | ||
11 | This document will try to discuss what alternatives for the deprecated | |
12 | features are available. | |
13 | ||
14 | The deprecated features will be grouped by the version of Perl in | |
15 | which they will be removed. | |
16 | ||
71451039 PE |
17 | =head2 Perl 5.40 |
18 | ||
19 | =head3 Downgrading a C<use VERSION> to below v5.11 | |
20 | ||
21 | Once Perl has seen a C<use VERSION> declaration that requests a version | |
22 | C<v5.11> or above, a subsequent second declaration that requests an earlier | |
23 | version will print a deprecation warning. For example, | |
24 | ||
25 | use v5.14; | |
26 | say "We can use v5.14's features here"; | |
27 | ||
28 | use v5.10; # This prints a warning | |
29 | ||
30 | This behaviour will be removed in Perl 5.40; such a subsequent request will | |
31 | become a compile-time error. | |
32 | ||
33 | This is because of an intended related change to the interaction between | |
34 | C<use VERSION> and C<use strict>. If you specify a version >= 5.11, strict is | |
35 | enabled implicitly. If you request a version < 5.11, strict will become | |
36 | disabled I<even if you had previously written> C<use strict>. This was not | |
37 | the previous behaviour of C<use VERSION>, which at present will track | |
38 | explicitly-enabled strictness flags independently. | |
39 | ||
68327975 JK |
40 | =head2 Perl 5.38 |
41 | ||
42 | =head3 Pod::Html utility functions | |
43 | ||
44 | The definition and documentation of three utility functions previously | |
45 | importable from L<Pod::Html> were moved to new package L<Pod::Html::Util> in | |
46 | Perl 5.36. While they remain importable from L<Pod::Html> in Perl 5.36, as of | |
47 | Perl 5.38 they will only be importable, on request, from L<Pod::Html::Util>. | |
48 | ||
a74d5574 JK |
49 | =head2 Perl 5.34 |
50 | ||
51 | There are no deprecations or fatalizations scheduled for Perl 5.34. | |
52 | ||
9840d1d6 A |
53 | =head2 Perl 5.32 |
54 | ||
55 | =head3 Constants from lexical variables potentially modified elsewhere | |
56 | ||
57 | You wrote something like | |
58 | ||
59 | my $var; | |
60 | $sub = sub () { $var }; | |
61 | ||
62 | but $var is referenced elsewhere and could be modified after the C<sub> | |
63 | expression is evaluated. Either it is explicitly modified elsewhere | |
64 | (C<$var = 3>) or it is passed to a subroutine or to an operator like | |
65 | C<printf> or C<map>, which may or may not modify the variable. | |
66 | ||
67 | Traditionally, Perl has captured the value of the variable at that | |
68 | point and turned the subroutine into a constant eligible for inlining. | |
69 | In those cases where the variable can be modified elsewhere, this | |
70 | breaks the behavior of closures, in which the subroutine captures | |
71 | the variable itself, rather than its value, so future changes to the | |
72 | variable are reflected in the subroutine's return value. | |
73 | ||
74 | If you intended for the subroutine to be eligible for inlining, then | |
75 | make sure the variable is not referenced elsewhere, possibly by | |
76 | copying it: | |
77 | ||
78 | my $var2 = $var; | |
79 | $sub = sub () { $var2 }; | |
80 | ||
81 | If you do want this subroutine to be a closure that reflects future | |
82 | changes to the variable that it closes over, add an explicit C<return>: | |
83 | ||
84 | my $var; | |
85 | $sub = sub () { return $var }; | |
86 | ||
c6b2e294 | 87 | This usage was deprecated and as of Perl 5.32 is no longer allowed. |
9840d1d6 | 88 | |
fada8285 | 89 | =head3 Use of strings with code points over 0xFF as arguments to C<vec> |
76aae383 KW |
90 | |
91 | C<vec> views its string argument as a sequence of bits. A string | |
92 | containing a code point over 0xFF is nonsensical. This usage is | |
da5a0da2 | 93 | deprecated in Perl 5.28, and was removed in Perl 5.32. |
76aae383 | 94 | |
ba52ce15 KW |
95 | =head3 Use of code points over 0xFF in string bitwise operators |
96 | ||
97 | The string bitwise operators, C<&>, C<|>, C<^>, and C<~>, treat their | |
98 | operands as strings of bytes. As such, values above 0xFF are | |
99 | nonsensical. Some instances of these have been deprecated since Perl | |
100 | 5.24, and were made fatal in 5.28, but it turns out that in cases where | |
101 | the wide characters did not affect the end result, no deprecation | |
102 | notice was raised, and so remain legal. Now, all occurrences either are | |
103 | fatal or raise a deprecation warning, so that the remaining legal | |
c8b94fe0 | 104 | occurrences became fatal in 5.32. |
ba52ce15 KW |
105 | |
106 | An example of this is | |
107 | ||
108 | "" & "\x{100}" | |
109 | ||
110 | The wide character is not used in the C<&> operation because the left | |
c8b94fe0 | 111 | operand is shorter. This now throws an exception. |
ba52ce15 | 112 | |
0c9c439d Z |
113 | =head3 hostname() doesn't accept any arguments |
114 | ||
115 | The function C<hostname()> in the L<Sys::Hostname> module has always | |
116 | been documented to be called with no arguments. Historically it has not | |
117 | enforced this, and has actually accepted and ignored any arguments. As a | |
118 | result, some users have got the mistaken impression that an argument does | |
119 | something useful. To avoid these bugs, the function is being made strict. | |
c6b2e294 | 120 | Passing arguments was deprecated in Perl 5.28 and became fatal in Perl 5.32. |
0c9c439d | 121 | |
0367231c KW |
122 | =head3 Unescaped left braces in regular expressions |
123 | ||
124 | The simple rule to remember, if you want to match a literal C<{> | |
125 | character (U+007B C<LEFT CURLY BRACKET>) in a regular expression | |
126 | pattern, is to escape each literal instance of it in some way. | |
127 | Generally easiest is to precede it with a backslash, like C<\{> | |
128 | or enclose it in square brackets (C<[{]>). If the pattern | |
129 | delimiters are also braces, any matching right brace (C<}>) should | |
130 | also be escaped to avoid confusing the parser, for example, | |
131 | ||
132 | qr{abc\{def\}ghi} | |
133 | ||
134 | Forcing literal C<{> characters to be escaped will enable the Perl | |
135 | language to be extended in various ways in future releases. To avoid | |
a3815e44 | 136 | needlessly breaking existing code, the restriction is not enforced in |
0367231c | 137 | contexts where there are unlikely to ever be extensions that could |
b2247a87 KW |
138 | conflict with the use there of C<{> as a literal. A non-deprecation |
139 | warning that the left brace is being taken literally is raised in | |
140 | contexts where there could be confusion about it. | |
0367231c KW |
141 | |
142 | Literal uses of C<{> were deprecated in Perl 5.20, and some uses of it | |
143 | started to give deprecation warnings since. These cases were made fatal | |
144 | in Perl 5.26. Due to an oversight, not all cases of a use of a literal | |
145 | C<{> got a deprecation warning. Some cases started warning in Perl 5.26, | |
c96bf7f6 | 146 | and were made fatal in Perl 5.30. Other cases started in Perl 5.28, |
ded8ea47 | 147 | and were made fatal in 5.32. |
0367231c | 148 | |
5203d63d KW |
149 | =head3 In XS code, use of various macros dealing with UTF-8. |
150 | ||
059703b0 KW |
151 | The macros below now require an extra parameter than in versions prior |
152 | to Perl 5.32. The final parameter in each one is a pointer into the | |
153 | string supplied by the first parameter beyond which the input will not | |
154 | be read. This prevents potential reading beyond the end of the buffer. | |
5203d63d KW |
155 | C<isALPHANUMERIC_utf8>, |
156 | C<isASCII_utf8>, | |
157 | C<isBLANK_utf8>, | |
158 | C<isCNTRL_utf8>, | |
159 | C<isDIGIT_utf8>, | |
160 | C<isIDFIRST_utf8>, | |
161 | C<isPSXSPC_utf8>, | |
162 | C<isSPACE_utf8>, | |
163 | C<isVERTWS_utf8>, | |
164 | C<isWORDCHAR_utf8>, | |
165 | C<isXDIGIT_utf8>, | |
166 | C<isALPHANUMERIC_LC_utf8>, | |
167 | C<isALPHA_LC_utf8>, | |
168 | C<isASCII_LC_utf8>, | |
169 | C<isBLANK_LC_utf8>, | |
170 | C<isCNTRL_LC_utf8>, | |
171 | C<isDIGIT_LC_utf8>, | |
172 | C<isGRAPH_LC_utf8>, | |
173 | C<isIDCONT_LC_utf8>, | |
174 | C<isIDFIRST_LC_utf8>, | |
175 | C<isLOWER_LC_utf8>, | |
176 | C<isPRINT_LC_utf8>, | |
177 | C<isPSXSPC_LC_utf8>, | |
178 | C<isPUNCT_LC_utf8>, | |
179 | C<isSPACE_LC_utf8>, | |
180 | C<isUPPER_LC_utf8>, | |
181 | C<isWORDCHAR_LC_utf8>, | |
182 | C<isXDIGIT_LC_utf8>, | |
183 | C<toFOLD_utf8>, | |
184 | C<toLOWER_utf8>, | |
185 | C<toTITLE_utf8>, | |
186 | and | |
187 | C<toUPPER_utf8>. | |
188 | ||
059703b0 KW |
189 | Since Perl 5.26, this functionality with the extra parameter has been |
190 | available by using a corresponding macro to each one of these, and whose | |
191 | name is formed by appending C<_safe> to the base name. There is no | |
192 | change to the functionality of those. For example, C<isDIGIT_utf8_safe> | |
193 | corresponds to C<isDIGIT_utf8>, and both now behave identically. All | |
194 | are documented in L<perlapi/Character case changing> and | |
5203d63d KW |
195 | L<perlapi/Character classification>. |
196 | ||
ded8ea47 KW |
197 | This change was originally scheduled for 5.30, but was delayed until |
198 | 5.32. | |
5203d63d | 199 | |
4db50d5b S |
200 | =head3 C<< File::Glob::glob() >> was removed |
201 | ||
202 | C<< File::Glob >> has a function called C<< glob >>, which just calls | |
203 | C<< bsd_glob >>. | |
204 | ||
205 | C<< File::Glob::glob() >> was deprecated in Perl 5.8. A deprecation | |
793b4089 DIM |
206 | message was issued from Perl 5.26 onwards, the function became fatal |
207 | in Perl 5.30, and was removed entirely in Perl 5.32. | |
4db50d5b S |
208 | |
209 | Code using C<< File::Glob::glob() >> should call | |
210 | C<< File::Glob::bsd_glob() >> instead. | |
211 | ||
a0e213fc A |
212 | =head2 Perl 5.30 |
213 | ||
37398dc1 A |
214 | =head3 C<< $* >> is no longer supported |
215 | ||
216 | Before Perl 5.10, setting C<< $* >> to a true value globally enabled | |
217 | multi-line matching within a string. This relique from the past lost | |
793b4089 | 218 | its special meaning in 5.10. Use of this variable became a fatal error |
37398dc1 A |
219 | in Perl 5.30, freeing the variable up for a future special meaning. |
220 | ||
221 | To enable multiline matching one should use the C<< /m >> regexp | |
222 | modifier (possibly in combination with C<< /s >>). This can be set | |
223 | on a per match bases, or can be enabled per lexical scope (including | |
224 | a whole file) with C<< use re '/m' >>. | |
225 | ||
226 | =head3 C<< $# >> is no longer supported | |
227 | ||
228 | This variable used to have a special meaning -- it could be used | |
229 | to control how numbers were formatted when printed. This seldom | |
230 | used functionality was removed in Perl 5.10. In order to free up | |
793b4089 | 231 | the variable for a future special meaning, its use became a fatal |
37398dc1 A |
232 | error in Perl 5.30. |
233 | ||
33f0d962 | 234 | To specify how numbers are formatted when printed, one is advised |
37398dc1 A |
235 | to use C<< printf >> or C<< sprintf >> instead. |
236 | ||
c22e17d0 | 237 | =head3 Assigning non-zero to C<< $[ >> is fatal |
8e796115 DIM |
238 | |
239 | This variable (and the corresponding C<array_base> feature and | |
c22e17d0 | 240 | L<arybase> module) allowed changing the base for array and string |
8e796115 DIM |
241 | indexing operations. |
242 | ||
243 | Setting this to a non-zero value has been deprecated since Perl 5.12 and | |
c22e17d0 | 244 | throws a fatal error as of Perl 5.30. |
8e796115 | 245 | |
a0e213fc A |
246 | =head3 C<< File::Glob::glob() >> will disappear |
247 | ||
248 | C<< File::Glob >> has a function called C<< glob >>, which just calls | |
249 | C<< bsd_glob >>. However, its prototype is different from the prototype | |
250 | of C<< CORE::glob >>, and hence, C<< File::Glob::glob >> should not | |
251 | be used. | |
252 | ||
d1be68f6 | 253 | C<< File::Glob::glob() >> was deprecated in Perl 5.8. A deprecation |
793b4089 DIM |
254 | message was issued from Perl 5.26 onwards, and in Perl 5.30 this was |
255 | turned into a fatal error. | |
a0e213fc A |
256 | |
257 | Code using C<< File::Glob::glob() >> should call | |
258 | C<< File::Glob::bsd_glob() >> instead. | |
259 | ||
0367231c | 260 | =head3 Unescaped left braces in regular expressions (for 5.30) |
286c9456 | 261 | |
0367231c | 262 | See L</Unescaped left braces in regular expressions> above. |
286c9456 | 263 | |
30b17cc1 A |
264 | =head3 Unqualified C<dump()> |
265 | ||
266 | Use of C<dump()> instead of C<CORE::dump()> was deprecated in Perl 5.8, | |
793b4089 | 267 | and an unqualified C<dump()> is no longer available as of Perl 5.30. |
30b17cc1 A |
268 | |
269 | See L<perlfunc/dump>. | |
270 | ||
286c9456 | 271 | |
afb5c82e | 272 | =head3 Using my() in false conditional. |
c437f7ac A |
273 | |
274 | There has been a long-standing bug in Perl that causes a lexical variable | |
275 | not to be cleared at scope exit when its declaration includes a false | |
276 | conditional. Some people have exploited this bug to achieve a kind of | |
bbadd5d3 | 277 | static variable. To allow us to fix this bug, people should not be |
c437f7ac A |
278 | relying on this behavior. |
279 | ||
280 | Instead, it's recommended one uses C<state> variables to achieve the | |
281 | same effect: | |
282 | ||
283 | use 5.10.0; | |
284 | sub count {state $counter; return ++ $counter} | |
285 | say count (); # Prints 1 | |
286 | say count (); # Prints 2 | |
287 | ||
288 | C<state> variables were introduced in Perl 5.10. | |
289 | ||
290 | Alternatively, you can achieve a similar static effect by | |
bbadd5d3 | 291 | declaring the variable in a separate block outside the function, e.g., |
c437f7ac A |
292 | |
293 | sub f { my $x if 0; return $x++ } | |
294 | ||
295 | becomes | |
296 | ||
297 | { my $x; sub f { return $x++ } } | |
298 | ||
299 | The use of C<my()> in a false conditional has been deprecated in | |
bbadd5d3 | 300 | Perl 5.10, and became a fatal error in Perl 5.30. |
c437f7ac | 301 | |
1972ac5c A |
302 | |
303 | =head3 Reading/writing bytes from/to :utf8 handles. | |
304 | ||
305 | The sysread(), recv(), syswrite() and send() operators are | |
306 | deprecated on handles that have the C<:utf8> layer, either explicitly, or | |
307 | implicitly, eg., with the C<:encoding(UTF-16LE)> layer. | |
308 | ||
309 | Both sysread() and recv() currently use only the C<:utf8> flag for the stream, | |
310 | ignoring the actual layers. Since sysread() and recv() do no UTF-8 | |
311 | validation they can end up creating invalidly encoded scalars. | |
312 | ||
313 | Similarly, syswrite() and send() use only the C<:utf8> flag, otherwise ignoring | |
314 | any layers. If the flag is set, both write the value UTF-8 encoded, even if | |
315 | the layer is some different encoding, such as the example above. | |
316 | ||
317 | Ideally, all of these operators would completely ignore the C<:utf8> state, | |
318 | working only with bytes, but this would result in silently breaking existing | |
319 | code. To avoid this a future version of perl will throw an exception when | |
320 | any of sysread(), recv(), syswrite() or send() are called on handle with the | |
321 | C<:utf8> layer. | |
322 | ||
793b4089 | 323 | As of Perl 5.30, it is no longer be possible to use sysread(), recv(), |
1972ac5c A |
324 | syswrite() or send() to read or send bytes from/to :utf8 handles. |
325 | ||
30573109 A |
326 | |
327 | =head3 Use of unassigned code point or non-standalone grapheme for a delimiter. | |
328 | ||
329 | A grapheme is what appears to a native-speaker of a language to be a | |
330 | character. In Unicode (and hence Perl) a grapheme may actually be | |
331 | several adjacent characters that together form a complete grapheme. For | |
332 | example, there can be a base character, like "R" and an accent, like a | |
4c821bda KW |
333 | circumflex "^", that appear to be a single character when displayed, |
334 | with the circumflex hovering over the "R". | |
335 | ||
336 | As of Perl 5.30, use of delimiters which are non-standalone graphemes is | |
337 | fatal, in order to move the language to be able to accept | |
338 | multi-character graphemes as delimiters. | |
339 | ||
c96bf7f6 | 340 | Also, as of Perl 5.30, delimiters which are unassigned code points |
4c821bda KW |
341 | but that may someday become assigned are prohibited. Otherwise, code |
342 | that works today would fail to compile if the currently unassigned | |
343 | delimiter ends up being something that isn't a stand-alone grapheme. | |
344 | Because Unicode is never going to assign L<non-character code | |
345 | points|perlunicode/Noncharacter code points>, nor L<code points that are | |
c96bf7f6 | 346 | above the legal Unicode maximum|perlunicode/Beyond Unicode code |
4c821bda | 347 | points>, those can be delimiters. |
30573109 | 348 | |
c9680906 A |
349 | =head2 Perl 5.28 |
350 | ||
dcc013e3 | 351 | =head3 Attributes C<< :locked >> and C<< :unique >> |
c9680906 A |
352 | |
353 | The attributes C<< :locked >> (on code references) and C<< :unique >> | |
354 | (on array, hash and scalar references) have had no effect since | |
355 | Perl 5.005 and Perl 5.8.8 respectively. Their use has been deprecated | |
356 | since. | |
357 | ||
d1f1f359 | 358 | As of Perl 5.28, these attributes are syntax errors. Since the |
dcc013e3 A |
359 | attributes do not do anything, removing them from your code fixes |
360 | the syntax error; and removing them will not influence the behaviour | |
361 | of your code. | |
c9680906 | 362 | |
ac641426 | 363 | |
e5aa3f0b A |
364 | =head3 Bare here-document terminators |
365 | ||
366 | Perl has allowed you to use a bare here-document terminator to have the | |
367 | here-document end at the first empty line. This practise was deprecated | |
d1f1f359 | 368 | in Perl 5.000; as of Perl 5.28, using a bare here-document terminator |
dcc013e3 | 369 | throws a fatal error. |
e5aa3f0b | 370 | |
33f0d962 | 371 | You are encouraged to use the explicitly quoted form if you wish to |
e5aa3f0b A |
372 | use an empty line as the terminator of the here-document: |
373 | ||
374 | print <<""; | |
375 | Print this line. | |
376 | ||
377 | # Previous blank line ends the here-document. | |
378 | ||
379 | ||
d8940893 A |
380 | =head3 Setting $/ to a reference to a non-positive integer |
381 | ||
382 | You assigned a reference to a scalar to C<$/> where the | |
383 | referenced item is not a positive integer. In older perls this B<appeared> | |
384 | to work the same as setting it to C<undef> but was in fact internally | |
385 | different, less efficient and with very bad luck could have resulted in | |
386 | your file being split by a stringified form of the reference. | |
387 | ||
388 | In Perl 5.20.0 this was changed so that it would be B<exactly> the same as | |
389 | setting C<$/> to undef, with the exception that this warning would be | |
390 | thrown. | |
391 | ||
dcc013e3 A |
392 | As of Perl 5.28, setting C<$/> to a reference of a non-positive |
393 | integer throws a fatal error. | |
d8940893 A |
394 | |
395 | You are recommended to change your code to set C<$/> to C<undef> explicitly | |
396 | if you wish to slurp the file. | |
397 | ||
398 | ||
fcdb3ac1 A |
399 | =head3 Limit on the value of Unicode code points. |
400 | ||
dcc013e3 A |
401 | Unicode only allows code points up to 0x10FFFF, but Perl allows |
402 | much larger ones. Up till Perl 5.28, it was allowed to use code | |
403 | points exceeding the maximum value of an integer (C<IV_MAX>). | |
404 | However, that did break the perl interpreter in some constructs, | |
405 | including causing it to hang in a few cases. The known problem | |
406 | areas were in C<tr///>, regular expression pattern matching using | |
407 | quantifiers, as quote delimiters in C<qI<X>...I<X>> (where I<X> is | |
408 | the C<chr()> of a large code point), and as the upper limits in | |
409 | loops. | |
fcdb3ac1 | 410 | |
d1f1f359 | 411 | The use of out of range code points was deprecated in Perl 5.24; as of |
dcc013e3 | 412 | Perl 5.28 using a code point exceeding C<IV_MAX> throws a fatal error. |
fcdb3ac1 A |
413 | |
414 | If your code is to run on various platforms, keep in mind that the upper | |
dcc013e3 A |
415 | limit depends on the platform. It is much larger on 64-bit word sizes |
416 | than 32-bit ones. For 32-bit integers, C<IV_MAX> equals C<0x7FFFFFFF>, | |
417 | for 64-bit integers, C<IV_MAX> equals C<0x7FFFFFFFFFFFFFFF>. | |
fcdb3ac1 | 418 | |
db99d38d | 419 | |
6ef4f8b7 A |
420 | =head3 Use of comma-less variable list in formats. |
421 | ||
dcc013e3 | 422 | It was allowed to use a list of variables in a format, without |
6ef4f8b7 | 423 | separating them with commas. This usage has been deprecated |
d1f1f359 | 424 | for a long time, and as of Perl 5.28, this throws a fatal error. |
6ef4f8b7 | 425 | |
db99d38d A |
426 | =head3 Use of C<\N{}> |
427 | ||
428 | Use of C<\N{}> with nothing between the braces was deprecated in | |
be332ba0 | 429 | Perl 5.24, and throws a fatal error as of Perl 5.28. |
db99d38d A |
430 | |
431 | Since such a construct is equivalent to using an empty string, | |
432 | you are recommended to remove such C<\N{}> constructs. | |
433 | ||
122d6c09 A |
434 | =head3 Using the same symbol to open a filehandle and a dirhandle |
435 | ||
436 | It used to be legal to use C<open()> to associate both a | |
437 | filehandle and a dirhandle to the same symbol (glob or scalar). | |
438 | This idiom is likely to be confusing, and it was deprecated in | |
439 | Perl 5.10. | |
440 | ||
441 | Using the same symbol to C<open()> a filehandle and a dirhandle | |
d1f1f359 | 442 | throws a fatal error as of Perl 5.28. |
122d6c09 A |
443 | |
444 | You should be using two different symbols instead. | |
445 | ||
ac641426 A |
446 | =head3 ${^ENCODING} is no longer supported. |
447 | ||
448 | The special variable C<${^ENCODING}> was used to implement | |
449 | the C<encoding> pragma. Setting this variable to anything other | |
450 | than C<undef> was deprecated in Perl 5.22. Full deprecation | |
451 | of the variable happened in Perl 5.25.3. | |
452 | ||
dcc013e3 | 453 | Setting this variable to anything other than an undefined value |
d1f1f359 | 454 | throws a fatal error as of Perl 5.28. |
ac641426 | 455 | |
d9d53e86 | 456 | |
838ba4df A |
457 | =head3 C<< B::OP::terse >> |
458 | ||
459 | This method, which just calls C<< B::Concise::b_terse >>, has been | |
dcc013e3 | 460 | deprecated, and disappeared in Perl 5.28. Please use |
838ba4df A |
461 | C<< B::Concise >> instead. |
462 | ||
463 | ||
d9d53e86 | 464 | |
dcc013e3 | 465 | =head3 Use of inherited AUTOLOAD for non-method %s::%s() is no longer allowed |
d9d53e86 | 466 | |
dcc013e3 | 467 | As an (ahem) accidental feature, C<AUTOLOAD> subroutines were looked |
d9d53e86 A |
468 | up as methods (using the C<@ISA> hierarchy) even when the subroutines |
469 | to be autoloaded were called as plain functions (e.g. C<Foo::bar()>), | |
470 | not as methods (e.g. C<< Foo->bar() >> or C<< $obj->bar() >>). | |
471 | ||
dcc013e3 A |
472 | This bug was deprecated in Perl 5.004, has been rectified in Perl 5.28 |
473 | by using method lookup only for methods' C<AUTOLOAD>s. | |
d9d53e86 A |
474 | |
475 | The simple rule is: Inheritance will not work when autoloading | |
476 | non-methods. The simple fix for old code is: In any module that used | |
477 | to depend on inheriting C<AUTOLOAD> for non-methods from a base class | |
478 | named C<BaseClass>, execute C<*AUTOLOAD = \&BaseClass::AUTOLOAD> during | |
479 | startup. | |
480 | ||
481 | In code that currently says C<use AutoLoader; @ISA = qw(AutoLoader);> | |
482 | you should remove AutoLoader from @ISA and change C<use AutoLoader;> to | |
483 | C<use AutoLoader 'AUTOLOAD';>. | |
484 | ||
d9d53e86 | 485 | |
ecbcbef0 A |
486 | =head3 Use of code points over 0xFF in string bitwise operators |
487 | ||
488 | The string bitwise operators, C<&>, C<|>, C<^>, and C<~>, treat | |
489 | their operands as strings of bytes. As such, values above 0xFF | |
490 | are nonsensical. Using such code points with these operators | |
d1f1f359 | 491 | was deprecated in Perl 5.24, and is fatal as of Perl 5.28. |
ecbcbef0 | 492 | |
36d3e805 KW |
493 | =head3 In XS code, use of C<to_utf8_case()> |
494 | ||
f566c7cf | 495 | This function has been removed as of Perl 5.28; instead convert to call |
36d3e805 KW |
496 | the appropriate one of: |
497 | L<C<toFOLD_utf8_safe>|perlapi/toFOLD_utf8_safe>. | |
498 | L<C<toLOWER_utf8_safe>|perlapi/toLOWER_utf8_safe>, | |
499 | L<C<toTITLE_utf8_safe>|perlapi/toTITLE_utf8_safe>, | |
500 | or | |
501 | L<C<toUPPER_utf8_safe>|perlapi/toUPPER_utf8_safe>. | |
bfdc8cd3 | 502 | |
856f8944 A |
503 | =head2 Perl 5.26 |
504 | ||
505 | =head3 C<< --libpods >> in C<< Pod::Html >> | |
506 | ||
507 | Since Perl 5.18, the option C<< --libpods >> has been deprecated, and | |
508 | using this option did not do anything other than producing a warning. | |
509 | ||
d1f1f359 | 510 | The C<< --libpods >> option is no longer recognized as of Perl 5.26. |
856f8944 A |
511 | |
512 | ||
2560602c A |
513 | =head3 The utilities C<< c2ph >> and C<< pstruct >> |
514 | ||
515 | These old, perl3-era utilities have been deprecated in favour of | |
d1f1f359 | 516 | C<< h2xs >> for a long time. As of Perl 5.26, they have been removed. |
2560602c | 517 | |
d9d53e86 | 518 | |
4a29ab5e A |
519 | =head3 Trapping C<< $SIG {__DIE__} >> other than during program exit. |
520 | ||
521 | The C<$SIG{__DIE__}> hook is called even inside an C<eval()>. It was | |
522 | never intended to happen this way, but an implementation glitch made | |
523 | this possible. This used to be deprecated, as it allowed strange action | |
524 | at a distance like rewriting a pending exception in C<$@>. Plans to | |
525 | rectify this have been scrapped, as users found that rewriting a | |
526 | pending exception is actually a useful feature, and not a bug. | |
527 | ||
528 | Perl never issued a deprecation warning for this; the deprecation | |
529 | was by documentation policy only. But this deprecation has been | |
d1f1f359 | 530 | lifted as of Perl 5.26. |
4a29ab5e A |
531 | |
532 | ||
24ca4586 A |
533 | =head3 Malformed UTF-8 string in "%s" |
534 | ||
535 | This message indicates a bug either in the Perl core or in XS | |
536 | code. Such code was trying to find out if a character, allegedly | |
537 | stored internally encoded as UTF-8, was of a given type, such as | |
538 | being punctuation or a digit. But the character was not encoded | |
539 | in legal UTF-8. The C<%s> is replaced by a string that can be used | |
540 | by knowledgeable people to determine what the type being checked | |
541 | against was. | |
542 | ||
543 | Passing malformed strings was deprecated in Perl 5.18, and | |
544 | became fatal in Perl 5.26. | |
545 | ||
546 | ||
9021a1cf A |
547 | =head2 Perl 5.24 |
548 | ||
549 | =head3 Use of C<< *glob{FILEHANDLE} >> | |
550 | ||
d1be68f6 | 551 | The use of C<< *glob{FILEHANDLE} >> was deprecated in Perl 5.8. |
9021a1cf A |
552 | The intention was to use C<< *glob{IO} >> instead, for which |
553 | C<< *glob{FILEHANDLE} >> is an alias. | |
554 | ||
d1be68f6 | 555 | However, this feature was undeprecated in Perl 5.24. |
9021a1cf | 556 | |
46d7f3c1 A |
557 | =head3 Calling POSIX::%s() is deprecated |
558 | ||
559 | The following functions in the C<POSIX> module are no longer available: | |
560 | C<isalnum>, C<isalpha>, C<iscntrl>, C<isdigit>, C<isgraph>, C<islower>, | |
561 | C<isprint>, C<ispunct>, C<isspace>, C<isupper>, and C<isxdigit>. The | |
562 | functions are buggy and don't work on UTF-8 encoded strings. See their | |
563 | entries in L<POSIX> for more information. | |
564 | ||
d1be68f6 | 565 | The functions were deprecated in Perl 5.20, and removed in Perl 5.24. |
46d7f3c1 A |
566 | |
567 | ||
c4d8d6a2 A |
568 | =head2 Perl 5.16 |
569 | ||
570 | =head3 Use of %s on a handle without * is deprecated | |
571 | ||
572 | It used to be possible to use C<tie>, C<tied> or C<untie> on a scalar | |
573 | while the scalar holds a typeglob. This caused its filehandle to be | |
574 | tied. It left no way to tie the scalar itself when it held a typeglob, | |
575 | and no way to untie a scalar that had had a typeglob assigned to it. | |
576 | ||
d1be68f6 | 577 | This was deprecated in Perl 5.14, and the bug was fixed in Perl 5.16. |
c4d8d6a2 A |
578 | |
579 | So now C<tie $scalar> will always tie the scalar, not the handle it holds. | |
580 | To tie the handle, use C<tie *$scalar> (with an explicit asterisk). The same | |
581 | applies to C<tied *$scalar> and C<untie *$scalar>. | |
582 | ||
583 | ||
9021a1cf A |
584 | =head1 SEE ALSO |
585 | ||
586 | L<warnings>, L<diagnostics>. | |
587 | ||
588 | =cut |