Commit | Line | Data |
6c7deadb |
1 | =head1 NAME |
2 | |
70693193 |
3 | perl594delta - what is new for perl v5.9.4 |
6c7deadb |
4 | |
5 | =head1 DESCRIPTION |
6 | |
7 | This document describes differences between the 5.9.3 and the 5.9.4 |
a1889f3a |
8 | development releases. See L<perl590delta>, L<perl591delta>, L<perl592delta> |
6c7deadb |
9 | and L<perl593delta> for the differences between 5.8.0 and 5.9.3. |
10 | |
11 | =head1 Incompatible Changes |
12 | |
4db748fd |
13 | =head2 chdir FOO |
14 | |
473aa102 |
15 | A bareword argument to chdir() is now recognized as a file handle. |
4db748fd |
16 | Earlier releases interpreted the bareword as a directory name. |
21a732f3 |
17 | (Gisle Aas) |
4db748fd |
18 | |
ddc61b51 |
19 | =head2 Handling of pmc files |
20 | |
b7d91234 |
21 | An old feature of perl was that before C<require> or C<use> look for a |
473aa102 |
22 | file with a F<.pm> extension, they will first look for a similar filename |
23 | with a F<.pmc> extension. If this file is found, it will be loaded in |
24 | place of any potentially existing file ending in a F<.pm> extension. |
ddc61b51 |
25 | |
473aa102 |
26 | Previously, F<.pmc> files were loaded only if more recent than the |
27 | matching F<.pm> file. Starting with 5.9.4, they'll be always loaded if |
28 | they exist. (This trick is used by Pugs.) |
ddc61b51 |
29 | |
30 | =head2 @- and @+ in patterns |
31 | |
32 | The special arrays C<@-> and C<@+> are no longer interpolated in regular |
21a732f3 |
33 | expressions. (Sadahiro Tomoyuki) |
ddc61b51 |
34 | |
5d121f7f |
35 | =head2 $AUTOLOAD can now be tainted |
36 | |
37 | If you call a subroutine by a tainted name, and if it defers to an |
38 | AUTOLOAD function, then $AUTOLOAD will be (correctly) tainted. |
21a732f3 |
39 | (Rick Delaney) |
5d121f7f |
40 | |
6c7deadb |
41 | =head1 Core Enhancements |
42 | |
6c20a8f9 |
43 | =head2 state() variables |
44 | |
3c1cb5e0 |
45 | A new class of variables has been introduced. State variables are similar |
46 | to C<my> variables, but are declared with the C<state> keyword in place of |
a1889f3a |
47 | C<my>. They're visible only in their lexical scope, but their value is |
3c1cb5e0 |
48 | persistent: unlike C<my> variables, they're not undefined at scope entry, |
a1889f3a |
49 | but retain their previous value. (Rafael Garcia-Suarez) |
3c1cb5e0 |
50 | |
51 | To use state variables, one needs to enable them by using |
52 | |
53 | use feature "state"; |
54 | |
55 | or by using the C<-E> command-line switch in one-liners. |
56 | |
57 | See L<perlsub/"Persistent variables via state()">. |
58 | |
d06a6528 |
59 | =head2 UNIVERSAL::DOES() |
ddc61b51 |
60 | |
3c1cb5e0 |
61 | The C<UNIVERSAL> class has a new method, C<DOES()>. It has been added to |
62 | solve semantic problems with the C<isa()> method. C<isa()> checks for |
a1889f3a |
63 | inheritance, while C<DOES()> has been designed to be overridden when |
3c1cb5e0 |
64 | module authors use other types of relations between classes (in addition |
21a732f3 |
65 | to inheritance). (chromatic) |
3c1cb5e0 |
66 | |
67 | See L<< UNIVERSAL/"$obj->DOES( ROLE )" >>. |
68 | |
21a732f3 |
69 | =head2 Exceptions in constant folding |
70 | |
71 | The constant folding routine is now wrapped in an exception handler, and |
72 | if folding throws an exception (such as attempting to evaluate 0/0), perl |
73 | now retains the current optree, rather than aborting the whole program. |
b7d91234 |
74 | (Nicholas Clark, Dave Mitchell) |
75 | |
76 | =head2 Source filters in @INC |
77 | |
78 | It's possible to enhance the mechanism of subroutine hooks in @INC by |
79 | adding a source filter on top of the filehandle opened and returned by the |
80 | hook. This feature was planned a long time ago, but wasn't quite working |
81 | until now. See L<perlfunc/require> for details. (Nicholas Clark) |
82 | |
83 | =head2 MAD |
84 | |
85 | MAD, which stands for I<Misc Attribute Decoration>, is a |
6eac1a45 |
86 | still-in-development work leading to a Perl 5 to Perl 6 converter. To |
b7d91234 |
87 | enable it, it's necessary to pass the argument C<-Dmad> to Configure. The |
88 | obtained perl isn't binary compatible with a regular perl 5.9.4, and has |
89 | space and speed penalties; moreover not all regression tests still pass |
90 | with it. (Larry Wall, Nicholas Clark) |
21a732f3 |
91 | |
6eac1a45 |
92 | =head1 Modules and Pragmas |
6c7deadb |
93 | |
b7d91234 |
94 | =over 4 |
95 | |
96 | =item * |
97 | |
473aa102 |
98 | C<encoding::warnings> is now a lexical pragma. (Although on older perls, |
99 | which don't have support for lexical pragmas, it keeps its global |
21a732f3 |
100 | behaviour.) (Audrey Tang) |
6c20a8f9 |
101 | |
b7d91234 |
102 | =item * |
103 | |
104 | C<threads> is now a dual-life module, also available on CPAN. It has been |
105 | expanded in many ways. A kill() method is available for thread signalling. |
106 | One can get thread status, or the list of running or joinable threads. |
107 | |
108 | A new C<< threads->exit() >> method is used to exit from the application |
109 | (this is the default for the main thread) or from the current thread only |
110 | (this is the default for all other threads). On the other hand, the exit() |
111 | built-in now always causes the whole application to terminate. (Jerry |
112 | D. Hedden) |
113 | |
114 | =back |
ddc61b51 |
115 | |
6c20a8f9 |
116 | =head2 New Core Modules |
117 | |
118 | =over 4 |
119 | |
120 | =item * |
121 | |
21a732f3 |
122 | C<Hash::Util::FieldHash>, by Anno Siegel, has been added. This module |
123 | provides support for I<field hashes>: hashes that maintain an association |
124 | of a reference with a value, in a thread-safe garbage-collected way. |
ee4d86fe |
125 | Such hashes are useful to implement inside-out objects. |
ecf6cde6 |
126 | |
127 | =item * |
128 | |
21a732f3 |
129 | C<Module::Build>, by Ken Williams, has been added. It's an alternative to |
473aa102 |
130 | C<ExtUtils::MakeMaker> to build and install perl modules. |
131 | |
132 | =item * |
133 | |
b7d91234 |
134 | C<Module::Load>, by Jos Boumans, has been added. It provides a single |
135 | interface to load Perl modules and F<.pl> files. |
6c20a8f9 |
136 | |
137 | =item * |
138 | |
21a732f3 |
139 | C<Module::Loaded>, by Jos Boumans, has been added. It's used to mark |
140 | modules as loaded or unloaded. |
6c20a8f9 |
141 | |
142 | =item * |
143 | |
21a732f3 |
144 | C<Package::Constants>, by Jos Boumans, has been added. It's a simple |
145 | helper to list all constants declared in a given package. |
6c20a8f9 |
146 | |
d06a6528 |
147 | =item * |
148 | |
21a732f3 |
149 | C<Win32API::File>, by Tye McQueen, has been added (for Windows builds). |
150 | This module provides low-level access to Win32 system API calls for |
151 | files/dirs. |
d06a6528 |
152 | |
6c20a8f9 |
153 | =back |
154 | |
6c7deadb |
155 | =head1 Utility Changes |
156 | |
3c1cb5e0 |
157 | =head2 config_data |
158 | |
159 | C<config_data> is a new utility that comes with C<Module::Build>. It |
160 | provides a command-line interface to the configuration of Perl modules |
161 | that use Module::Build's framework of configurability (that is, |
6eac1a45 |
162 | C<*::ConfigData> modules that contain local configuration information for |
3c1cb5e0 |
163 | their parent modules.) |
164 | |
6c7deadb |
165 | =head1 Documentation |
166 | |
6c20a8f9 |
167 | =head2 New manpage, perlpragma |
168 | |
473aa102 |
169 | The L<perlpragma> manpage documents how to write one's own lexical |
a1889f3a |
170 | pragmas in pure Perl (something that is possible starting with 5.9.4). |
473aa102 |
171 | |
6c20a8f9 |
172 | =head2 New manpage, perlreguts |
173 | |
a1889f3a |
174 | The L<perlreguts> manpage, courtesy of Yves Orton, describes internals of the |
473aa102 |
175 | Perl regular expression engine. |
176 | |
6c20a8f9 |
177 | =head2 New manpage, perlunitut |
178 | |
473aa102 |
179 | The L<perlunitut> manpage is an tutorial for programming with Unicode and |
a1889f3a |
180 | string encodings in Perl, courtesy of Juerd Waalboer. |
473aa102 |
181 | |
6c7deadb |
182 | =head1 Performance Enhancements |
183 | |
ffb08095 |
184 | =head2 Memory optimisations |
185 | |
21a732f3 |
186 | Several internal data structures (typeglobs, GVs, CVs, formats) have been |
187 | restructured to use less memory. (Nicholas Clark) |
188 | |
ffb08095 |
189 | =head2 UTF-8 cache optimisation |
190 | |
21a732f3 |
191 | The UTF-8 caching code is now more efficient, and used more often. |
192 | (Nicholas Clark) |
193 | |
ffb08095 |
194 | =head2 Regular expressions |
195 | |
196 | =over 4 |
197 | |
6eac1a45 |
198 | =item Engine de-recursivised |
ffb08095 |
199 | |
200 | The regular expression engine is no longer recursive, meaning that |
201 | patterns that used to overflow the stack will either die with useful |
202 | explanations, or run to completion, which, since they were able to blow |
203 | the stack before, will likely take a very long time to happen. If you were |
204 | experiencing the occasional stack overflow (or segfault) and upgrade to |
205 | discover that now perl apparently hangs instead, look for a degenerate |
b7d91234 |
206 | regex. (Dave Mitchell) |
ffb08095 |
207 | |
208 | =item Single char char-classes treated as literals |
209 | |
b7d91234 |
210 | Classes of a single character are now treated the same as if the character |
211 | had been used as a literal, meaning that code that uses char-classes as an |
212 | escaping mechanism will see a speedup. (Yves Orton) |
ffb08095 |
213 | |
214 | =item Trie optimisation of literal string alternations |
215 | |
216 | Alternations, where possible, are optimised into more efficient matching |
217 | structures. String literal alternations are merged into a trie and are |
218 | matched simultaneously. This means that instead of O(N) time for matching |
b7d91234 |
219 | N alternations at a given point the new code performs in O(1) time. (Yves |
220 | Orton) |
ffb08095 |
221 | |
222 | B<Note:> Much code exists that works around perl's historic poor |
223 | performance on alternations. Often the tricks used to do so will disable |
224 | the new optimisations. Hopefully the utility modules used for this purpose |
225 | will be educated about these new optimisations by the time 5.10 is |
226 | released. |
227 | |
228 | =item Aho-Corasick start-point optimisation |
229 | |
230 | When a pattern starts with a trie-able alternation and there aren't |
231 | better optimisations available the regex engine will use Aho-Corasick |
b7d91234 |
232 | matching to find the start point. (Yves Orton) |
ffb08095 |
233 | |
234 | =back |
6c20a8f9 |
235 | |
8a6dcfeb |
236 | =head2 Sloppy stat on Windows |
237 | |
238 | On Windows, perl's stat() function normally opens the file to determine |
239 | the link count and update attributes that may have been changed through |
240 | hard links. Setting ${^WIN32_SLOPPY_STAT} to a true value speeds up |
241 | stat() by not performing this operation. (Jan Dubois) |
242 | |
6c7deadb |
243 | =head1 Installation and Configuration Improvements |
244 | |
21a732f3 |
245 | =head2 Relocatable installations |
246 | |
b7d91234 |
247 | There is now Configure support for creating a relocatable perl tree. If |
248 | you Configure with C<-Duserelocatableinc>, then the paths in @INC (and |
249 | everything else in %Config) can be optionally located via the path of the |
250 | perl executable. |
251 | |
252 | That means that, if the string C<".../"> is found at the start of any |
253 | path, it's substituted with the directory of $^X. So, the relocation can |
254 | be configured on a per-directory basis, although the default with |
255 | C<-Duserelocatableinc> is that everything is relocated. The initial |
256 | install is done to the original configured prefix. |
21a732f3 |
257 | |
ddc61b51 |
258 | =head2 Ports |
259 | |
473aa102 |
260 | Many improvements have been made towards making Perl work correctly on |
261 | z/OS. |
262 | |
3c1cb5e0 |
263 | Perl has been reported to work on DragonFlyBSD. |
264 | |
ddc61b51 |
265 | =head2 Compilation improvements |
266 | |
267 | All F<ppport.h> files in the XS modules bundled with perl are now |
21a732f3 |
268 | autogenerated at build time. (Marcus Holland-Moritz) |
ddc61b51 |
269 | |
270 | =head2 New probes |
271 | |
3c1cb5e0 |
272 | The configuration process now detects whether strlcat() and strlcpy() are |
ddc61b51 |
273 | available. When they are not available, perl's own version is used (from |
274 | Russ Allbery's public domain implementation). Various places in the perl |
a1889f3a |
275 | interpreter now use them. (Steve Peters) |
ddc61b51 |
276 | |
8a6dcfeb |
277 | =head2 Windows build improvements |
278 | |
279 | =over 4 |
280 | |
281 | =item Building XS extensions |
282 | |
283 | Support for building XS extension modules with the free MinGW compiler has |
284 | been improved in the case where perl itself was built with the Microsoft |
285 | VC++ compiler. (ActiveState) |
286 | |
681be82f |
287 | =item Support for 64-bit compiler |
8a6dcfeb |
288 | |
289 | Support for building perl with Microsoft's 64-bit compiler has been |
290 | improved. (ActiveState) |
291 | |
292 | =back |
293 | |
6c7deadb |
294 | =head1 Selected Bug Fixes |
295 | |
473aa102 |
296 | =head2 PERL5SHELL and tainting |
297 | |
6eac1a45 |
298 | On Windows, the PERL5SHELL environment variable is now checked for |
299 | taintedness. (Rafael Garcia-Suarez) |
473aa102 |
300 | |
301 | =head2 Using *FILE{IO} |
302 | |
303 | C<stat()> and C<-X> filetests now treat *FILE{IO} filehandles like *FILE |
21a732f3 |
304 | filehandles. (Steve Peters) |
305 | |
306 | =head2 Overloading and reblessing |
307 | |
308 | Overloading now works when references are reblessed into another class. |
309 | Internally, this has been implemented by moving the flag for "overloading" |
310 | from the reference to the referent, which logically is where it should |
311 | always have been. (Nicholas Clark) |
312 | |
313 | =head2 Overloading and UTF-8 |
314 | |
315 | A few bugs related to UTF-8 handling with objects that have |
316 | stringification overloaded have been fixed. (Nicholas Clark) |
473aa102 |
317 | |
6eac1a45 |
318 | =head2 eval memory leaks fixed |
319 | |
320 | Traditionally, C<eval 'syntax error'> has leaked badly. Many (but not all) |
321 | of these leaks have now been eliminated or reduced. (Dave Mitchell) |
322 | |
8a6dcfeb |
323 | =head2 Random device on Windows |
324 | |
325 | In previous versions, perl would read the file F</dev/urandom> if it |
326 | existed when seeding its random number generator. That file is unlikely |
327 | to exist on Windows, and if it did would probably not contain appropriate |
328 | data, so perl no longer tries to read it on Windows. (Alex Davies) |
329 | |
6c7deadb |
330 | =head1 New or Changed Diagnostics |
331 | |
21a732f3 |
332 | =over 4 |
333 | |
334 | =item State variable %s will be reinitialized |
335 | |
336 | One can assign initial values to state variables, but not when they're |
337 | declared as a sub-part of a list assignment. See L<perldiag>. |
338 | |
339 | =back |
340 | |
6c7deadb |
341 | =head1 Changed Internals |
342 | |
3c1cb5e0 |
343 | A new file, F<mathoms.c>, contains functions that aren't used anymore in |
6eac1a45 |
344 | the perl core, but remain around because modules out there might |
3c1cb5e0 |
345 | still use them. They come from a factorization effort: for example, many |
346 | PP functions are now shared for several ops. |
6c20a8f9 |
347 | |
b7d91234 |
348 | The implementation of the special variables $^H and %^H has changed, to |
349 | allow implementing lexical pragmas in pure perl. |
350 | |
6c7deadb |
351 | =head1 Known Problems |
352 | |
3c1cb5e0 |
353 | One warning test (number 263 in F<lib/warnings.t>) fails under UTF-8 |
354 | locales. |
355 | |
a1889f3a |
356 | Bytecode tests fail under several platforms. We are considering removing |
b7d91234 |
357 | support for byteloader and compiler before the 5.10.0 release. |
6c7deadb |
358 | |
359 | =head1 Reporting Bugs |
360 | |
361 | If you find what you think is a bug, you might check the articles |
362 | recently posted to the comp.lang.perl.misc newsgroup and the perl |
36d7017e |
363 | bug database at http://rt.perl.org/rt3/ . There may also be |
6c7deadb |
364 | information at http://www.perl.org/ , the Perl Home Page. |
365 | |
366 | If you believe you have an unreported bug, please run the B<perlbug> |
367 | program included with your release. Be sure to trim your bug down |
368 | to a tiny but sufficient test case. Your bug report, along with the |
369 | output of C<perl -V>, will be sent off to perlbug@perl.org to be |
370 | analysed by the Perl porting team. |
371 | |
372 | =head1 SEE ALSO |
373 | |
374 | The F<Changes> file for exhaustive details on what changed. |
375 | |
376 | The F<INSTALL> file for how to build Perl. |
377 | |
378 | The F<README> file for general stuff. |
379 | |
380 | The F<Artistic> and F<Copying> files for copyright information. |
381 | |
382 | =cut |