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