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 | ||
a0e213fc A |
17 | =head2 Perl 5.30 |
18 | ||
19 | =head3 C<< File::Glob::glob() >> will disappear | |
20 | ||
21 | C<< File::Glob >> has a function called C<< glob >>, which just calls | |
22 | C<< bsd_glob >>. However, its prototype is different from the prototype | |
23 | of C<< CORE::glob >>, and hence, C<< File::Glob::glob >> should not | |
24 | be used. | |
25 | ||
d1be68f6 A |
26 | C<< File::Glob::glob() >> was deprecated in Perl 5.8. A deprecation |
27 | message was issued from Perl 5.26 onwards, and the function will | |
28 | disappear in Perl 5.30. | |
a0e213fc A |
29 | |
30 | Code using C<< File::Glob::glob() >> should call | |
31 | C<< File::Glob::bsd_glob() >> instead. | |
32 | ||
c9680906 A |
33 | =head2 Perl 5.28 |
34 | ||
35 | =head3 Attribute "%s" is deprecated, and will disappear in 5.28 | |
36 | ||
37 | The attributes C<< :locked >> (on code references) and C<< :unique >> | |
38 | (on array, hash and scalar references) have had no effect since | |
39 | Perl 5.005 and Perl 5.8.8 respectively. Their use has been deprecated | |
40 | since. | |
41 | ||
42 | These attributes will no longer be recognized in Perl 5.28, and will | |
43 | then result in a syntax error. Since the attributes do not do anything, | |
44 | removing them from your code fixes the deprecation warning; and removing | |
45 | them will not influence the behaviour of your code. | |
46 | ||
ac641426 | 47 | |
122d6c09 A |
48 | =head3 Using the same symbol to open a filehandle and a dirhandle |
49 | ||
50 | It used to be legal to use C<open()> to associate both a | |
51 | filehandle and a dirhandle to the same symbol (glob or scalar). | |
52 | This idiom is likely to be confusing, and it was deprecated in | |
53 | Perl 5.10. | |
54 | ||
55 | Using the same symbol to C<open()> a filehandle and a dirhandle | |
56 | will be a fatal error in Perl 5.28. | |
57 | ||
58 | You should be using two different symbols instead. | |
59 | ||
ac641426 A |
60 | =head3 ${^ENCODING} is no longer supported. |
61 | ||
62 | The special variable C<${^ENCODING}> was used to implement | |
63 | the C<encoding> pragma. Setting this variable to anything other | |
64 | than C<undef> was deprecated in Perl 5.22. Full deprecation | |
65 | of the variable happened in Perl 5.25.3. | |
66 | ||
67 | Setting this variable will become a fatal error in Perl 5.28. | |
68 | ||
9021a1cf A |
69 | =head2 Perl 5.24 |
70 | ||
71 | =head3 Use of C<< *glob{FILEHANDLE} >> | |
72 | ||
d1be68f6 | 73 | The use of C<< *glob{FILEHANDLE} >> was deprecated in Perl 5.8. |
9021a1cf A |
74 | The intention was to use C<< *glob{IO} >> instead, for which |
75 | C<< *glob{FILEHANDLE} >> is an alias. | |
76 | ||
d1be68f6 | 77 | However, this feature was undeprecated in Perl 5.24. |
9021a1cf | 78 | |
46d7f3c1 A |
79 | =head3 Calling POSIX::%s() is deprecated |
80 | ||
81 | The following functions in the C<POSIX> module are no longer available: | |
82 | C<isalnum>, C<isalpha>, C<iscntrl>, C<isdigit>, C<isgraph>, C<islower>, | |
83 | C<isprint>, C<ispunct>, C<isspace>, C<isupper>, and C<isxdigit>. The | |
84 | functions are buggy and don't work on UTF-8 encoded strings. See their | |
85 | entries in L<POSIX> for more information. | |
86 | ||
d1be68f6 | 87 | The functions were deprecated in Perl 5.20, and removed in Perl 5.24. |
46d7f3c1 A |
88 | |
89 | ||
c4d8d6a2 A |
90 | =head2 Perl 5.16 |
91 | ||
92 | =head3 Use of %s on a handle without * is deprecated | |
93 | ||
94 | It used to be possible to use C<tie>, C<tied> or C<untie> on a scalar | |
95 | while the scalar holds a typeglob. This caused its filehandle to be | |
96 | tied. It left no way to tie the scalar itself when it held a typeglob, | |
97 | and no way to untie a scalar that had had a typeglob assigned to it. | |
98 | ||
d1be68f6 | 99 | This was deprecated in Perl 5.14, and the bug was fixed in Perl 5.16. |
c4d8d6a2 A |
100 | |
101 | So now C<tie $scalar> will always tie the scalar, not the handle it holds. | |
102 | To tie the handle, use C<tie *$scalar> (with an explicit asterisk). The same | |
103 | applies to C<tied *$scalar> and C<untie *$scalar>. | |
104 | ||
105 | ||
52b37024 A |
106 | =head2 Perl 5.10 |
107 | ||
108 | =head3 $* is no longer supported | |
109 | ||
110 | C<$*> was once a magic variable. C<$*> enabled or disabled | |
111 | multi-line matching within a string. Deprecated since Perl 5.000, | |
112 | its special meaning was removed in Perl 5.10. Aftwards, an | |
113 | deprecation message was issued when using this variable; this message | |
114 | was discontinued in Perl 5.26. | |
115 | ||
116 | Instead of using C<$*> you should use the C</m> (and maybe C</s>) regexp | |
117 | modifiers. You can enable C</m> for a lexical scope (even a whole file) | |
118 | with C<use re '/m'>. (In older versions: when C<$*> was set to a true value | |
119 | then all regular expressions behaved as if they were written using C</m>.) | |
120 | ||
121 | Although you can use C<$*> as a normal variable, you are discouraged | |
122 | from doing so. | |
123 | ||
124 | =head3 $# is no longer supported | |
125 | ||
126 | C<$#> was once a magic variable. C<$#> could be used to format | |
127 | printed numbers. Deprecated since Perl 5.000, | |
128 | its special meaning was removed in Perl 5.10. Aftwards, an | |
129 | deprecation message was issued when using this variable; this message | |
130 | was discontinued in Perl 5.26. | |
131 | ||
132 | Instead of using C<$#>, you should be using C<(s)printf> to format | |
133 | your numbers. | |
134 | ||
cb4e545c | 135 | Although you can use C<$#> as a normal variable, you are discouraged |
52b37024 A |
136 | from doing so. |
137 | ||
138 | ||
9021a1cf A |
139 | =head1 SEE ALSO |
140 | ||
141 | L<warnings>, L<diagnostics>. | |
142 | ||
143 | =cut |