3 perldelta - what is new for perl v5.9.4
7 This document describes differences between the 5.9.3 and the 5.9.4
8 developement releases. See L<perl590delta>, L<perl591delta>, L<perl592delta>
9 and L<perl593delta> for the differences between 5.8.0 and 5.9.3.
11 =head1 Incompatible Changes
15 A bareword argument to chdir() is now recognized as a file handle.
16 Earlier releases interpreted the bareword as a directory name.
19 =head2 Handling of pmc files
21 And old feature of perl is that before C<require> or C<use> look for a
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.
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.)
30 =head2 @- and @+ in patterns
32 The special arrays C<@-> and C<@+> are no longer interpolated in regular
33 expressions. (Sadahiro Tomoyuki)
35 =head2 $AUTOLOAD can now be tainted
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.
41 =head1 Core Enhancements
43 =head2 state() variables
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
47 C<my>. They're visible only in their lexical scope, but their value in
48 persistent: unlike C<my> variables, they're not undefined at scope entry,
49 and retain their previous value. (Rafael Garcia-Suarez)
51 To use state variables, one needs to enable them by using
55 or by using the C<-E> command-line switch in one-liners.
57 See L<perlsub/"Persistent variables via state()">.
59 =head2 UNIVERSAL::DOES()
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
63 inheritance, while C<DOES()> has been designed to be overriden when
64 module authors use other types of relations between classes (in addition
65 to inheritance). (chromatic)
67 See L<< UNIVERSAL/"$obj->DOES( ROLE )" >>.
69 =head2 Exceptions in constant folding
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.
76 =head1 Modules and Pragmata
78 C<encoding::warnings> is now a lexical pragma. (Although on older perls,
79 which don't have support for lexical pragmas, it keeps its global
80 behaviour.) (Audrey Tang)
84 =head2 New Core Modules
90 C<Hash::Util::FieldHash>, by Anno Siegel, has been added. This module
91 provides support for I<field hashes>: hashes that maintain an association
92 of a reference with a value, in a thread-safe garbage-collected way.
96 C<Module::Build>, by Ken Williams, has been added. It's an alternative to
97 C<ExtUtils::MakeMaker> to build and install perl modules.
101 C<Module::Load>, by Jos Boumans, has been added. It's used to load
102 indistinctively modules and files.
106 C<Module::Loaded>, by Jos Boumans, has been added. It's used to mark
107 modules as loaded or unloaded.
111 C<Package::Constants>, by Jos Boumans, has been added. It's a simple
112 helper to list all constants declared in a given package.
116 C<Win32API::File>, by Tye McQueen, has been added (for Windows builds).
117 This module provides low-level access to Win32 system API calls for
122 =head1 Utility Changes
126 C<config_data> is a new utility that comes with C<Module::Build>. It
127 provides a command-line interface to the configuration of Perl modules
128 that use Module::Build's framework of configurability (that is,
129 C<*::ConfigData> modules, that contain local configuration information for
130 their parent modules.)
134 =head2 New manpage, perlpragma
136 The L<perlpragma> manpage documents how to write one's own lexical
137 pragmas in pure Perl (something that is possible only starting with
140 =head2 New manpage, perlreguts
142 The L<perlreguts> manpage, due to Yves Orton, describes internals of the
143 Perl regular expression engine.
145 =head2 New manpage, perlunitut
147 The L<perlunitut> manpage is an tutorial for programming with Unicode and
148 string encodings in Perl, due to Juerd Waalboer.
150 =head1 Performance Enhancements
152 =head2 Memory optimisations
154 Several internal data structures (typeglobs, GVs, CVs, formats) have been
155 restructured to use less memory. (Nicholas Clark)
157 =head2 UTF-8 cache optimisation
159 The UTF-8 caching code is now more efficient, and used more often.
162 =head2 Regular expressions
166 =item Engine de-recursiveized
168 The regular expression engine is no longer recursive, meaning that
169 patterns that used to overflow the stack will either die with useful
170 explanations, or run to completion, which, since they were able to blow
171 the stack before, will likely take a very long time to happen. If you were
172 experiencing the occasional stack overflow (or segfault) and upgrade to
173 discover that now perl apparently hangs instead, look for a degenerate
176 =item Single char char-classes treated as literals
178 Classes of a single character are now treated the same as if the
179 character had been used as a literal, meaning that code that uses
180 char-classes as an escaping mechanism will see a speedup.
182 =item Trie optimisation of literal string alternations
184 Alternations, where possible, are optimised into more efficient matching
185 structures. String literal alternations are merged into a trie and are
186 matched simultaneously. This means that instead of O(N) time for matching
187 N alternations at a given point the new code performs in O(1) time.
189 B<Note:> Much code exists that works around perl's historic poor
190 performance on alternations. Often the tricks used to do so will disable
191 the new optimisations. Hopefully the utility modules used for this purpose
192 will be educated about these new optimisations by the time 5.10 is
195 =item Aho-Corasick start-point optimisation
197 When a pattern starts with a trie-able alternation and there aren't
198 better optimisations available the regex engine will use Aho-Corasick
199 matching to find the start point.
203 =head1 Installation and Configuration Improvements
205 =head2 Relocatable installations
211 Many improvements have been made towards making Perl work correctly on
214 Perl has been reported to work on DragonFlyBSD.
216 =head2 Compilation improvements
218 All F<ppport.h> files in the XS modules bundled with perl are now
219 autogenerated at build time. (Marcus Holland-Moritz)
223 The configuration process now detects whether strlcat() and strlcpy() are
224 available. When they are not available, perl's own version is used (from
225 Russ Allbery's public domain implementation). Various places in the perl
226 interpreter now uses them. (Steve Peters)
228 =head1 Selected Bug Fixes
230 =head2 PERL5SHELL and tainting
232 On Windows, PERL5SHELL is now checked for taintedness. (Rafael
235 =head2 Using *FILE{IO}
237 C<stat()> and C<-X> filetests now treat *FILE{IO} filehandles like *FILE
238 filehandles. (Steve Peters)
240 =head2 Overloading and reblessing
242 Overloading now works when references are reblessed into another class.
243 Internally, this has been implemented by moving the flag for "overloading"
244 from the reference to the referent, which logically is where it should
245 always have been. (Nicholas Clark)
247 =head2 Overloading and UTF-8
249 A few bugs related to UTF-8 handling with objects that have
250 stringification overloaded have been fixed. (Nicholas Clark)
252 =head1 New or Changed Diagnostics
256 =item State variable %s will be reinitialized
258 One can assign initial values to state variables, but not when they're
259 declared as a sub-part of a list assignment. See L<perldiag>.
263 =head1 Changed Internals
265 A new file, F<mathoms.c>, contains functions that aren't used anymore in
266 the perl core, but that remain around because modules out there might
267 still use them. They come from a factorization effort: for example, many
268 PP functions are now shared for several ops.
270 =head1 Known Problems
272 One warning test (number 263 in F<lib/warnings.t>) fails under UTF-8
275 Bytecode tests fails under several platforms. Support for byteloader and
276 compiler is considered to be removed before the 5.10.0 release.
278 =head2 Platform-specific Problems
280 The test F<ext/Socket/t/socketpair.t> crashes after completing all tests
281 successfully when built with USE_ITHREADS and PERL_IMPLICIT_SYS on Win32.
283 =head1 Reporting Bugs
285 If you find what you think is a bug, you might check the articles
286 recently posted to the comp.lang.perl.misc newsgroup and the perl
287 bug database at http://rt.perl.org/rt3/ . There may also be
288 information at http://www.perl.org/ , the Perl Home Page.
290 If you believe you have an unreported bug, please run the B<perlbug>
291 program included with your release. Be sure to trim your bug down
292 to a tiny but sufficient test case. Your bug report, along with the
293 output of C<perl -V>, will be sent off to perlbug@perl.org to be
294 analysed by the Perl porting team.
298 The F<Changes> file for exhaustive details on what changed.
300 The F<INSTALL> file for how to build Perl.
302 The F<README> file for general stuff.
304 The F<Artistic> and F<Copying> files for copyright information.