Commit | Line | Data |
---|---|---|
1400179b NC |
1 | =head1 NAME |
2 | ||
70693193 | 3 | perl591delta - what is new for perl v5.9.1 |
1400179b NC |
4 | |
5 | =head1 DESCRIPTION | |
6 | ||
f15752a5 | 7 | This document describes differences between the 5.9.0 and the 5.9.1 |
fa11829f | 8 | development releases. See L<perl590delta> for the differences between |
9b11ae5e | 9 | 5.8.0 and 5.9.0. |
1400179b NC |
10 | |
11 | =head1 Incompatible Changes | |
12 | ||
3c1c0f69 RGS |
13 | =head2 substr() lvalues are no longer fixed-length |
14 | ||
15 | The lvalues returned by the three argument form of substr() used to be a | |
16 | "fixed length window" on the original string. In some cases this could | |
17 | cause surprising action at distance or other undefined behaviour. Now the | |
fa11829f | 18 | length of the window adjusts itself to the length of the string assigned to |
3c1c0f69 RGS |
19 | it. |
20 | ||
21 | =head2 The C<:unique> attribute is only meaningful for globals | |
22 | ||
23 | Now applying C<:unique> to lexical variables and to subroutines will | |
24 | result in a compilation error. | |
25 | ||
1400179b NC |
26 | =head1 Core Enhancements |
27 | ||
59f00321 RGS |
28 | =head2 Lexical C<$_> |
29 | ||
30 | The default variable C<$_> can now be lexicalized, by declaring it like | |
31 | any other lexical variable, with a simple | |
32 | ||
33 | my $_; | |
34 | ||
35 | The operations that default on C<$_> will use the lexically-scoped | |
36 | version of C<$_> when it exists, instead of the global C<$_>. | |
37 | ||
38 | In a C<map> or a C<grep> block, if C<$_> was previously my'ed, then the | |
39 | C<$_> inside the block is lexical as well (and scoped to the block). | |
40 | ||
41 | In a scope where C<$_> has been lexicalized, you can still have access to | |
42 | the global version of C<$_> by using C<$::_>, or, more simply, by | |
43 | overriding the lexical declaration with C<our $_>. | |
44 | ||
1400179b NC |
45 | =head2 Tied hashes in scalar context |
46 | ||
f99d9048 RGS |
47 | As of perl 5.8.2/5.9.0, tied hashes did not return anything useful in |
48 | scalar context, for example when used as boolean tests: | |
1400179b NC |
49 | |
50 | if (%tied_hash) { ... } | |
51 | ||
52 | The old nonsensical behaviour was always to return false, | |
53 | regardless of whether the hash is empty or has elements. | |
54 | ||
55 | There is now an interface for the implementors of tied hashes to implement | |
56 | the behaviour of a hash in scalar context, via the SCALAR method (see | |
57 | L<perltie>). Without a SCALAR method, perl will try to guess whether | |
58 | the hash is empty, by testing if it's inside an iteration (in this case | |
59 | it can't be empty) or by calling FIRSTKEY. | |
60 | ||
f0f92e3c RGS |
61 | =head2 Formats |
62 | ||
63 | Formats were improved in several ways. A new field, C<^*>, can be used for | |
64 | variable-width, one-line-at-a-time text. Null characters are now handled | |
65 | correctly in picture lines. Using C<@#> and C<~~> together will now | |
66 | produce a compile-time error, as those format fields are incompatible. | |
67 | L<perlform> has been improved, and miscellaneous bugs fixed. | |
68 | ||
fbb0b3b3 RGS |
69 | =head2 Stacked filetest operators |
70 | ||
71 | As a new form of syntactic sugar, it's now possible to stack up filetest | |
72 | operators. You can now write C<-f -w -x $file> in a row to mean | |
73 | C<-x $file && -w _ && -f _>. See L<perlfunc/-X>. | |
74 | ||
1400179b NC |
75 | =head1 Modules and Pragmata |
76 | ||
f0f92e3c RGS |
77 | =over 4 |
78 | ||
a1686c72 RGS |
79 | =item Benchmark |
80 | ||
81 | In C<Benchmark>, cmpthese() and timestr() now use the time statistics of | |
82 | children instead of parent when the selected style is 'nop'. | |
83 | ||
f0f92e3c RGS |
84 | =item Carp |
85 | ||
86 | The error messages produced by C<Carp> now include spaces between the | |
87 | arguments in function argument lists: this makes long error messages | |
88 | appear more nicely in browsers and other tools. | |
89 | ||
90 | =item Exporter | |
91 | ||
92 | C<Exporter> will now recognize grouping tags (such as C<:name>) anywhere | |
93 | in the import list, not only at the beginning. | |
94 | ||
95 | =item FindBin | |
96 | ||
97 | A function C<again> is provided to resolve problems where modules in different | |
98 | directories wish to use FindBin. | |
99 | ||
100 | =item List::Util | |
101 | ||
102 | You can now weaken references to read only values. | |
103 | ||
104 | =item threads::shared | |
105 | ||
106 | C<cond_wait> has a new two argument form. C<cond_timedwait> has been added. | |
107 | ||
108 | =back | |
109 | ||
1400179b NC |
110 | =head1 Utility Changes |
111 | ||
112 | C<find2perl> now assumes C<-print> as a default action. Previously, it | |
113 | needed to be specified explicitly. | |
114 | ||
f0f92e3c RGS |
115 | A new utility, C<prove>, makes it easy to run an individual regression test |
116 | at the command line. C<prove> is part of Test::Harness, which users of earlier | |
117 | Perl versions can install from CPAN. | |
118 | ||
466126d3 RGS |
119 | The perl debugger now supports a C<save> command, to save the current |
120 | history to a file, and an C<i> command, which prints the inheritance tree | |
121 | of its argument (if the C<Class::ISA> module is installed.) | |
122 | ||
f0f92e3c RGS |
123 | =head1 Documentation |
124 | ||
125 | The documentation has been revised in places to produce more standard manpages. | |
126 | ||
127 | The long-existing feature of C</(?{...})/> regexps setting C<$_> and pos() | |
128 | is now documented. | |
1400179b | 129 | |
f99d9048 RGS |
130 | =head1 Performance Enhancements |
131 | ||
3c1c0f69 RGS |
132 | Sorting arrays in place (C<@a = sort @a>) is now optimized to avoid |
133 | making a temporary copy of the array. | |
134 | ||
466126d3 RGS |
135 | The operations involving case mapping on UTF-8 strings (uc(), lc(), |
136 | C<//i>, etc.) have been greatly speeded up. | |
137 | ||
3c1c0f69 RGS |
138 | Access to elements of lexical arrays via a numeric constant between 0 and |
139 | 255 is now faster. (This used to be only the case for global arrays.) | |
1400179b NC |
140 | |
141 | =head1 Selected Bug Fixes | |
142 | ||
3c1c0f69 | 143 | =head2 UTF-8 bugs |
f0f92e3c | 144 | |
3c1c0f69 RGS |
145 | Using substr() on a UTF-8 string could cause subsequent accesses on that |
146 | string to return garbage. This was due to incorrect UTF-8 offsets being | |
f0f92e3c RGS |
147 | cached, and is now fixed. |
148 | ||
149 | join() could return garbage when the same join() statement was used to | |
3c1c0f69 | 150 | process 8 bit data having earlier processed UTF-8 data, due to the flags |
f0f92e3c RGS |
151 | on that statement's temporary workspace not being reset correctly. This |
152 | is now fixed. | |
153 | ||
154 | Using Unicode keys with tied hashes should now work correctly. | |
155 | ||
3c1c0f69 RGS |
156 | chop() and chomp() used to mangle UTF-8 strings. This has been fixed. |
157 | ||
158 | sprintf() used to misbehave when the format string was in UTF-8. This is | |
159 | now fixed. | |
f0f92e3c RGS |
160 | |
161 | =head2 Threading bugs | |
162 | ||
163 | Hashes with the C<:unique> attribute weren't made read-only in new | |
164 | threads. They are now. | |
165 | ||
166 | =head2 More bugs | |
167 | ||
3c1c0f69 | 168 | C<$a .. $b> will now work as expected when either $a or $b is C<undef>. |
f0f92e3c RGS |
169 | |
170 | Reading $^E now preserves $!. Previously, the C code implementing $^E | |
171 | did not preserve C<errno>, so reading $^E could cause C<errno> and therefore | |
172 | C<$!> to change unexpectedly. | |
173 | ||
31a10c70 | 174 | C<strict> wasn't in effect in regexp-eval blocks (C</(?{...})/>). |
f0f92e3c | 175 | |
1400179b NC |
176 | =head1 New or Changed Diagnostics |
177 | ||
466126d3 RGS |
178 | A new deprecation warning, I<Deprecated use of my() in false conditional>, |
179 | has been added, to warn against the use of the dubious and deprecated | |
180 | construct | |
181 | ||
182 | my $x if 0; | |
183 | ||
184 | See L<perldiag>. | |
185 | ||
3c1c0f69 | 186 | The fatal error I<DESTROY created new reference to dead object> is now |
f0f92e3c RGS |
187 | documented in L<perldiag>. |
188 | ||
3c1c0f69 RGS |
189 | A new error, I<%ENV is aliased to %s>, is produced when taint checks are |
190 | enabled and when C<*ENV> has been aliased (and thus doesn't reflect the | |
f0f92e3c RGS |
191 | program's environment anymore.) |
192 | ||
1400179b NC |
193 | =head1 Changed Internals |
194 | ||
9b11ae5e RGS |
195 | These news matter to you only if you either write XS code or like to |
196 | know about or hack Perl internals (using Devel::Peek or any of the | |
197 | C<B::> modules counts), or like to run Perl with the C<-D> option. | |
198 | ||
199 | =head2 Reordering of SVt_* constants | |
200 | ||
201 | The relative ordering of constants that define the various types of C<SV> | |
fa46452e | 202 | have changed; in particular, C<SVt_PVGV> has been moved before C<SVt_PVLV>, |
9b11ae5e RGS |
203 | C<SVt_PVAV>, C<SVt_PVHV> and C<SVt_PVCV>. This is unlikely to make any |
204 | difference unless you have code that explicitly makes assumptions about that | |
205 | ordering. (The inheritance hierarchy of C<B::*> objects has been changed | |
206 | to reflect this.) | |
207 | ||
a5dbb3ac RGS |
208 | =head2 Removal of CPP symbols |
209 | ||
210 | The C preprocessor symbols C<PERL_PM_APIVERSION> and | |
211 | C<PERL_XS_APIVERSION>, which were supposed to give the version number of | |
212 | the oldest perl binary-compatible (resp. source-compatible) with the | |
213 | present one, were not used, and sometimes had misleading values. They have | |
214 | been removed. | |
215 | ||
265db0e6 RGS |
216 | =head2 Less space is used by ops |
217 | ||
218 | The C<BASEOP> structure now uses less space. The C<op_seq> field has been | |
219 | removed and replaced by two one-bit fields, C<op_opt> and C<op_static>. | |
220 | C<opt_type> is now 9 bits long. (Consequently, the C<B::OP> class doesn't | |
221 | provide an C<seq> method anymore.) | |
222 | ||
3c1c0f69 RGS |
223 | =head2 New parser |
224 | ||
225 | perl's parser is now generated by bison (it used to be generated by | |
226 | byacc.) As a result, it seems to be a bit more robust. | |
227 | ||
f0f92e3c RGS |
228 | =head1 Configuration and Building |
229 | ||
230 | C<Configure> now invokes callbacks regardless of the value of the variable | |
231 | they are called for. Previously callbacks were only invoked in the | |
232 | C<case $variable $define)> branch. This change should only affect platform | |
233 | maintainers writing configuration hints files. | |
234 | ||
f15752a5 | 235 | The portability and cleanliness of the Win32 makefiles has been improved. |
1400179b NC |
236 | |
237 | =head1 Known Problems | |
238 | ||
3c1c0f69 RGS |
239 | There are still a couple of problems in the implementation of the lexical |
240 | C<$_>: it doesn't work inside C</(?{...})/> blocks and with regard to the | |
241 | reverse() built-in used without arguments. (See the TODO tests in | |
242 | F<t/op/mydef.t>.) | |
243 | ||
244 | =head2 Platform Specific Problems | |
245 | ||
246 | The test F<ext/IPC/SysV/t/ipcsysv.t> may fail on OpenBSD. This hasn't been | |
247 | diagnosed yet. | |
248 | ||
249 | On some configurations on AIX 5, one test in F<lib/Time/Local.t> fails. | |
250 | When configured with long doubles, perl may fail tests 224-236 in | |
251 | F<t/op/pow.t> on the same platform. | |
252 | ||
1bafd7b3 RGS |
253 | For threaded builds, F<ext/threads/shared/t/wait.t> has been reported to |
254 | fail some tests on HP-UX 10.20. | |
255 | ||
3c1c0f69 RGS |
256 | =head1 To-do for perl 5.10.0 |
257 | ||
258 | This is a non-exhaustive, non-ordered, non-contractual and non-definitive | |
259 | list of things to do (or nice to have) for perl 5.10.0 : | |
260 | ||
261 | Clean up and finish support for assertions. See L<assertions>. | |
262 | ||
263 | Reimplement the mechanism of lexical pragmas to be more extensible. Fix | |
f15752a5 RGS |
264 | current pragmas that don't work well (or at all) with lexical scopes or in |
265 | run-time eval(STRING) (C<sort>, C<re>, C<encoding> for example). MJD has a | |
266 | preliminary patch that implements this. | |
f99d9048 RGS |
267 | |
268 | Fix (or rewrite) the implementation of the C</(?{...})/> closures. | |
3c1c0f69 RGS |
269 | |
270 | Conversions from byte strings to UTF-8 currently map high bit characters | |
271 | to Unicode without translation (or, depending on how you look at it, by | |
f15752a5 RGS |
272 | implicitly assuming that the byte strings are in Latin-1). As perl assumes |
273 | the C locale by default, upgrading a string to UTF-8 may change the | |
274 | meaning of its contents regarding character classes, case mapping, etc. | |
275 | This should probably emit a warning (at least). | |
3c1c0f69 RGS |
276 | |
277 | Introduce a new special block, UNITCHECK, which is run at the end of a | |
278 | compilation unit (module, file, eval(STRING) block). This will correspond to | |
279 | the Perl 6 CHECK. Perl 5's CHECK cannot be changed or removed because the | |
f99d9048 | 280 | O.pm/B.pm backend framework depends on it. |
3c1c0f69 RGS |
281 | |
282 | Study the possibility of adding a new prototype character, C<_>, meaning | |
283 | "this argument defaults to $_". | |
284 | ||
285 | Make the peephole optimizer optional. | |
286 | ||
287 | Allow lexical aliases (maybe via the syntax C<my \$alias = \$foo>. | |
288 | ||
289 | Fix the bugs revealed by running the test suite with the C<-t> switch (via | |
290 | C<make test.taintwarn>). | |
291 | ||
292 | Make threads more robust. | |
293 | ||
1bafd7b3 | 294 | Make C<no 6> and C<no v6> work (opposite of C<use 5.005>, etc.). |
3c1c0f69 RGS |
295 | |
296 | A test suite for the B module would be nice. | |
297 | ||
298 | A ponie. | |
1400179b NC |
299 | |
300 | =head1 Reporting Bugs | |
301 | ||
302 | If you find what you think is a bug, you might check the articles | |
303 | recently posted to the comp.lang.perl.misc newsgroup and the perl | |
304 | bug database at http://bugs.perl.org/ . There may also be | |
f15752a5 | 305 | information at http://www.perl.org/ , the Perl Home Page. |
1400179b NC |
306 | |
307 | If you believe you have an unreported bug, please run the B<perlbug> | |
308 | program included with your release. Be sure to trim your bug down | |
309 | to a tiny but sufficient test case. Your bug report, along with the | |
310 | output of C<perl -V>, will be sent off to perlbug@perl.org to be | |
311 | analysed by the Perl porting team. | |
312 | ||
313 | =head1 SEE ALSO | |
314 | ||
315 | The F<Changes> file for exhaustive details on what changed. | |
316 | ||
317 | The F<INSTALL> file for how to build Perl. | |
318 | ||
319 | The F<README> file for general stuff. | |
320 | ||
321 | The F<Artistic> and F<Copying> files for copyright information. | |
322 | ||
323 | =cut |