This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl591delta.pod update.
[perl5.git] / pod / perl591delta.pod
1 =head1 NAME
2
3 perldelta - what is new for perl v5.9.1
4
5 =head1 DESCRIPTION
6
7 This document describes differences between the 5.9.0 release and
8 the 5.9.1 release. See L<perl590delta> for the differences between
9 5.8.0 and 5.9.0.
10
11 =head1 Incompatible Changes
12
13 =head1 Core Enhancements
14
15 =head2 Lexical C<$_>
16
17 The default variable C<$_> can now be lexicalized, by declaring it like
18 any other lexical variable, with a simple
19
20     my $_;
21
22 The operations that default on C<$_> will use the lexically-scoped
23 version of C<$_> when it exists, instead of the global C<$_>.
24
25 In a C<map> or a C<grep> block, if C<$_> was previously my'ed, then the
26 C<$_> inside the block is lexical as well (and scoped to the block).
27
28 In a scope where C<$_> has been lexicalized, you can still have access to
29 the global version of C<$_> by using C<$::_>, or, more simply, by
30 overriding the lexical declaration with C<our $_>.
31
32 =head2 Tied hashes in scalar context
33
34 As of perl 5.8.2, tied hashes did not return anything useful in scalar
35 context, for example when used as boolean tests:
36
37         if (%tied_hash) { ... }
38
39 The old nonsensical behaviour was always to return false,
40 regardless of whether the hash is empty or has elements.
41
42 There is now an interface for the implementors of tied hashes to implement
43 the behaviour of a hash in scalar context, via the SCALAR method (see
44 L<perltie>).  Without a SCALAR method, perl will try to guess whether
45 the hash is empty, by testing if it's inside an iteration (in this case
46 it can't be empty) or by calling FIRSTKEY.
47
48 =head2 Formats
49
50 Formats were improved in several ways. A new field, C<^*>, can be used for
51 variable-width, one-line-at-a-time text. Null characters are now handled
52 correctly in picture lines. Using C<@#> and C<~~> together will now
53 produce a compile-time error, as those format fields are incompatible.
54 L<perlform> has been improved, and miscellaneous bugs fixed.
55
56 =head2 The C<:unique> attribute is only meaningful for globals
57
58 Now applying C<:unique> to lexical variables and to subroutines will
59 result in a compilation error.
60
61 =head2 Stacked filetest operators
62
63 As a new form of syntactic sugar, it's now possible to stack up filetest
64 operators. You can now write C<-f -w -x $file> in a row to mean
65 C<-x $file && -w _ && -f _>. See L<perlfunc/-X>.
66
67 =head1 Modules and Pragmata
68
69 =over 4
70
71 =item Benchmark
72
73 In C<Benchmark>, cmpthese() and timestr() now use the time statistics of
74 children instead of parent when the selected style is 'nop'.
75
76 =item Carp
77
78 The error messages produced by C<Carp> now include spaces between the
79 arguments in function argument lists: this makes long error messages
80 appear more nicely in browsers and other tools.
81
82 =item Exporter
83
84 C<Exporter> will now recognize grouping tags (such as C<:name>) anywhere
85 in the import list, not only at the beginning.
86
87 =item FindBin
88
89 A function C<again> is provided to resolve problems where modules in different
90 directories wish to use FindBin.
91
92 =item List::Util
93
94 You can now weaken references to read only values.
95
96 =item threads::shared
97
98 C<cond_wait> has a new two argument form. C<cond_timedwait> has been added.
99
100 =back
101
102 =head1 Utility Changes
103
104 C<find2perl> now assumes C<-print> as a default action. Previously, it
105 needed to be specified explicitly.
106
107 A new utility, C<prove>, makes it easy to run an individual regression test
108 at the command line. C<prove> is part of Test::Harness, which users of earlier
109 Perl versions can install from CPAN.
110
111 The perl debugger now supports a C<save> command, to save the current
112 history to a file, and an C<i> command, which prints the inheritance tree
113 of its argument (if the C<Class::ISA> module is installed.)
114
115 =head1 Documentation
116
117 The documentation has been revised in places to produce more standard manpages.
118
119 The long-existing feature of C</(?{...})/> regexps setting C<$_> and pos()
120 is now documented.
121
122 =head1 Performance Enhancements
123
124 The operations involving case mapping on UTF-8 strings (uc(), lc(),
125 C<//i>, etc.) have been greatly speeded up.
126
127 =head1 Installation and Configuration Improvements
128
129 =head1 Selected Bug Fixes
130
131 =head2 UTF8 bugs
132
133 Using substr() on a UTF8 string could cause subsequent accesses on that
134 string to return garbage. This was due to incorrect UTF8 offsets being
135 cached, and is now fixed.
136
137 join() could return garbage when the same join() statement was used to
138 process 8 bit data having earlier processed UTF8 data, due to the flags
139 on that statement's temporary workspace not being reset correctly. This
140 is now fixed.
141
142 Using Unicode keys with tied hashes should now work correctly.
143
144 chop() and chomp() used to mangle UTF8 strings.  This has been fixed.
145
146 =head2 Threading bugs
147
148 Hashes with the C<:unique> attribute weren't made read-only in new
149 threads. They are now.
150
151 =head2 More bugs
152
153 C<$a .. $b> will now work as expected when either $a or $b is C<undef>
154
155 Reading $^E now preserves $!. Previously, the C code implementing $^E
156 did not preserve C<errno>, so reading $^E could cause C<errno> and therefore
157 C<$!> to change unexpectedly.
158
159 Reentrant functions will (once more) work with C++. 5.8.2 introduced a bugfix
160 which accidentally broke the compilation of Perl extensions written in C++.
161
162 C<strict> wasn't in effect in regexp-eval blocks (C</(?{...})/>).
163
164 =head1 New or Changed Diagnostics
165
166 A new deprecation warning, I<Deprecated use of my() in false conditional>,
167 has been added, to warn against the use of the dubious and deprecated
168 construct
169
170     my $x if 0;
171
172 See L<perldiag>.
173
174 The fatal error "DESTROY created new reference to dead object" is now
175 documented in L<perldiag>.
176
177 A new error, "%ENV is aliased to %s", is produced when taint checks are
178 enabled and when *ENV has been aliased (and thus doesn't reflect the
179 program's environment anymore.)
180
181 =head1 Changed Internals
182
183 These news matter to you only if you either write XS code or like to
184 know about or hack Perl internals (using Devel::Peek or any of the
185 C<B::> modules counts), or like to run Perl with the C<-D> option.
186
187 =head2 Reordering of SVt_* constants
188
189 The relative ordering of constants that define the various types of C<SV>
190 have changed; in particular, C<SVt_PVGV> has been moved before C<SVt_PVLV>,
191 C<SVt_PVAV>, C<SVt_PVHV> and C<SVt_PVCV>.  This is unlikely to make any
192 difference unless you have code that explicitly makes assumptions about that
193 ordering. (The inheritance hierarchy of C<B::*> objects has been changed
194 to reflect this.)
195
196 =head2 Removal of CPP symbols
197
198 The C preprocessor symbols C<PERL_PM_APIVERSION> and
199 C<PERL_XS_APIVERSION>, which were supposed to give the version number of
200 the oldest perl binary-compatible (resp. source-compatible) with the
201 present one, were not used, and sometimes had misleading values. They have
202 been removed.
203
204 =head2 Less space is used by ops
205
206 The C<BASEOP> structure now uses less space. The C<op_seq> field has been
207 removed and replaced by two one-bit fields, C<op_opt> and C<op_static>.
208 C<opt_type> is now 9 bits long. (Consequently, the C<B::OP> class doesn't
209 provide an C<seq> method anymore.)
210
211 =head1 Configuration and Building
212
213 C<Configure> now invokes callbacks regardless of the value of the variable
214 they are called for. Previously callbacks were only invoked in the
215 C<case $variable $define)> branch. This change should only affect platform
216 maintainers writing configuration hints files.
217
218 =head1 New Tests
219
220 =head1 Known Problems
221
222 =head1 Platform Specific Problems
223
224 =head1 Reporting Bugs
225
226 If you find what you think is a bug, you might check the articles
227 recently posted to the comp.lang.perl.misc newsgroup and the perl
228 bug database at http://bugs.perl.org/ .  There may also be
229 information at http://www.perl.com/ , the Perl Home Page.
230
231 If you believe you have an unreported bug, please run the B<perlbug>
232 program included with your release.  Be sure to trim your bug down
233 to a tiny but sufficient test case.  Your bug report, along with the
234 output of C<perl -V>, will be sent off to perlbug@perl.org to be
235 analysed by the Perl porting team.
236
237 =head1 SEE ALSO
238
239 The F<Changes> file for exhaustive details on what changed.
240
241 The F<INSTALL> file for how to build Perl.
242
243 The F<README> file for general stuff.
244
245 The F<Artistic> and F<Copying> files for copyright information.
246
247 =cut