77a111e87b8b4c680bb444f5abeea33f0ebfc27a
[p5sagit/p5-mst-13.2.git] / pod / perl594delta.pod
1 =head1 NAME
2
3 perldelta - what is new for perl v5.9.4
4
5 =head1 DESCRIPTION
6
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.
10
11 =head1 Incompatible Changes
12
13 =head2 chdir FOO
14
15 A bareword argument to chdir() is now recognized as a file handle.
16 Earlier releases interpreted the bareword as a directory name.
17 (Gisle Aas)
18
19 =head2 Handling of pmc files
20
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.
25
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.)
29
30 =head2 @- and @+ in patterns
31
32 The special arrays C<@-> and C<@+> are no longer interpolated in regular
33 expressions. (Sadahiro Tomoyuki)
34
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.
39 (Rick Delaney)
40
41 =head1 Core Enhancements
42
43 =head2 state() variables
44
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)
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
59 =head2 UNIVERSAL::DOES()
60
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)
66
67 See L<< UNIVERSAL/"$obj->DOES( ROLE )" >>.
68
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.
74 (Nicholas Clark)
75
76 =head1 Modules and Pragmata
77
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)
81
82 C<threads>
83
84 =head2 New Core Modules
85
86 =over 4
87
88 =item *
89
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.
93
94 =item *
95
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.
98
99 =item *
100
101 C<Module::Load>, by Jos Boumans, has been added. It's used to load
102 indistinctively modules and files.
103
104 =item *
105
106 C<Module::Loaded>, by Jos Boumans, has been added. It's used to mark
107 modules as loaded or unloaded.
108
109 =item *
110
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.
113
114 =item *
115
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
118 files/dirs.
119
120 =back
121
122 =head1 Utility Changes
123
124 =head2 config_data
125
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.)
131
132 =head1 Documentation
133
134 =head2 New manpage, perlpragma
135
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
138 5.9.4).
139
140 =head2 New manpage, perlreguts
141
142 The L<perlreguts> manpage, due to Yves Orton, describes internals of the
143 Perl regular expression engine.
144
145 =head2 New manpage, perlunitut
146
147 The L<perlunitut> manpage is an tutorial for programming with Unicode and
148 string encodings in Perl, due to Juerd Waalboer.
149
150 =head1 Performance Enhancements
151
152 =head2 Memory optimisations
153
154 Several internal data structures (typeglobs, GVs, CVs, formats) have been
155 restructured to use less memory. (Nicholas Clark)
156
157 =head2 UTF-8 cache optimisation
158
159 The UTF-8 caching code is now more efficient, and used more often.
160 (Nicholas Clark)
161
162 =head2 Regular expressions
163
164 =over 4
165
166 =item Engine de-recursiveized
167
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
174 regex.
175
176 =item Single char char-classes treated as literals
177
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.
181
182 =item Trie optimisation of literal string alternations
183
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.
188
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
193 released.
194
195 =item Aho-Corasick start-point optimisation
196
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.
200
201 =back
202
203 =head1 Installation and Configuration Improvements
204
205 =head2 Relocatable installations
206
207 TODO
208
209 =head2 Ports
210
211 Many improvements have been made towards making Perl work correctly on
212 z/OS.
213
214 Perl has been reported to work on DragonFlyBSD.
215
216 =head2 Compilation improvements
217
218 All F<ppport.h> files in the XS modules bundled with perl are now
219 autogenerated at build time. (Marcus Holland-Moritz)
220
221 =head2 New probes
222
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)
227
228 =head1 Selected Bug Fixes
229
230 =head2 PERL5SHELL and tainting
231
232 On Windows, PERL5SHELL is now checked for taintedness. (Rafael
233 Garcia-Suarez)
234
235 =head2 Using *FILE{IO}
236
237 C<stat()> and C<-X> filetests now treat *FILE{IO} filehandles like *FILE
238 filehandles. (Steve Peters)
239
240 =head2 Overloading and reblessing
241
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)
246
247 =head2 Overloading and UTF-8
248
249 A few bugs related to UTF-8 handling with objects that have
250 stringification overloaded have been fixed. (Nicholas Clark)
251
252 =head1 New or Changed Diagnostics
253
254 =over 4
255
256 =item State variable %s will be reinitialized
257
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>.
260
261 =back
262
263 =head1 Changed Internals
264
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.
269
270 =head1 Known Problems
271
272 One warning test (number 263 in F<lib/warnings.t>) fails under UTF-8
273 locales.
274
275 Bytecode tests fails under several platforms. Support for byteloader and
276 compiler is considered to be removed before the 5.10.0 release.
277
278 =head2 Platform-specific Problems
279
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.
282
283 =head1 Reporting Bugs
284
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.
289
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.
295
296 =head1 SEE ALSO
297
298 The F<Changes> file for exhaustive details on what changed.
299
300 The F<INSTALL> file for how to build Perl.
301
302 The F<README> file for general stuff.
303
304 The F<Artistic> and F<Copying> files for copyright information.
305
306 =cut