This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldelta entry describing regexp work, by Yves Orton
[perl5.git] / pod / perl594delta.pod
CommitLineData
6c7deadb
RGS
1=head1 NAME
2
3perldelta - what is new for perl v5.9.4
4
5=head1 DESCRIPTION
6
7This document describes differences between the 5.9.3 and the 5.9.4
8developement releases. See L<perl590delta>, L<perl591delta>, L<perl592delta>
9and L<perl593delta> for the differences between 5.8.0 and 5.9.3.
10
11=head1 Incompatible Changes
12
4db748fd
GA
13=head2 chdir FOO
14
473aa102 15A bareword argument to chdir() is now recognized as a file handle.
4db748fd 16Earlier releases interpreted the bareword as a directory name.
21a732f3 17(Gisle Aas)
4db748fd 18
ddc61b51
RGS
19=head2 Handling of pmc files
20
473aa102
RGS
21And old feature of perl is that before C<require> or C<use> look for a
22file with a F<.pm> extension, they will first look for a similar filename
23with a F<.pmc> extension. If this file is found, it will be loaded in
24place of any potentially existing file ending in a F<.pm> extension.
ddc61b51 25
473aa102
RGS
26Previously, F<.pmc> files were loaded only if more recent than the
27matching F<.pm> file. Starting with 5.9.4, they'll be always loaded if
28they exist. (This trick is used by Pugs.)
ddc61b51
RGS
29
30=head2 @- and @+ in patterns
31
32The special arrays C<@-> and C<@+> are no longer interpolated in regular
21a732f3 33expressions. (Sadahiro Tomoyuki)
ddc61b51 34
5d121f7f
RD
35=head2 $AUTOLOAD can now be tainted
36
37If you call a subroutine by a tainted name, and if it defers to an
38AUTOLOAD function, then $AUTOLOAD will be (correctly) tainted.
21a732f3 39(Rick Delaney)
5d121f7f 40
6c7deadb
RGS
41=head1 Core Enhancements
42
6c20a8f9
RGS
43=head2 state() variables
44
3c1cb5e0
RGS
45A new class of variables has been introduced. State variables are similar
46to C<my> variables, but are declared with the C<state> keyword in place of
47C<my>. They're visible only in their lexical scope, but their value in
48persistent: unlike C<my> variables, they're not undefined at scope entry,
21a732f3 49and retain their previous value. (Rafael Garcia-Suarez)
3c1cb5e0
RGS
50
51To use state variables, one needs to enable them by using
52
53 use feature "state";
54
55or by using the C<-E> command-line switch in one-liners.
56
57See L<perlsub/"Persistent variables via state()">.
58
d06a6528 59=head2 UNIVERSAL::DOES()
ddc61b51 60
3c1cb5e0
RGS
61The C<UNIVERSAL> class has a new method, C<DOES()>. It has been added to
62solve semantic problems with the C<isa()> method. C<isa()> checks for
63inheritance, while C<DOES()> has been designed to be overriden when
64module authors use other types of relations between classes (in addition
21a732f3 65to inheritance). (chromatic)
3c1cb5e0
RGS
66
67See L<< UNIVERSAL/"$obj->DOES( ROLE )" >>.
68
21a732f3
RGS
69=head2 Exceptions in constant folding
70
71The constant folding routine is now wrapped in an exception handler, and
72if folding throws an exception (such as attempting to evaluate 0/0), perl
73now retains the current optree, rather than aborting the whole program.
74(Nicholas Clark)
75
6c7deadb
RGS
76=head1 Modules and Pragmata
77
473aa102
RGS
78C<encoding::warnings> is now a lexical pragma. (Although on older perls,
79which don't have support for lexical pragmas, it keeps its global
21a732f3 80behaviour.) (Audrey Tang)
6c20a8f9 81
ddc61b51
RGS
82C<threads>
83
6c20a8f9
RGS
84=head2 New Core Modules
85
86=over 4
87
88=item *
89
21a732f3
RGS
90C<Hash::Util::FieldHash>, by Anno Siegel, has been added. This module
91provides support for I<field hashes>: hashes that maintain an association
92of a reference with a value, in a thread-safe garbage-collected way.
ecf6cde6
SH
93
94=item *
95
21a732f3 96C<Module::Build>, by Ken Williams, has been added. It's an alternative to
473aa102
RGS
97C<ExtUtils::MakeMaker> to build and install perl modules.
98
99=item *
100
21a732f3
RGS
101C<Module::Load>, by Jos Boumans, has been added. It's used to load
102indistinctively modules and files.
6c20a8f9
RGS
103
104=item *
105
21a732f3
RGS
106C<Module::Loaded>, by Jos Boumans, has been added. It's used to mark
107modules as loaded or unloaded.
6c20a8f9
RGS
108
109=item *
110
21a732f3
RGS
111C<Package::Constants>, by Jos Boumans, has been added. It's a simple
112helper to list all constants declared in a given package.
6c20a8f9 113
d06a6528
RGS
114=item *
115
21a732f3
RGS
116C<Win32API::File>, by Tye McQueen, has been added (for Windows builds).
117This module provides low-level access to Win32 system API calls for
118files/dirs.
d06a6528 119
6c20a8f9
RGS
120=back
121
6c7deadb
RGS
122=head1 Utility Changes
123
3c1cb5e0
RGS
124=head2 config_data
125
126C<config_data> is a new utility that comes with C<Module::Build>. It
127provides a command-line interface to the configuration of Perl modules
128that use Module::Build's framework of configurability (that is,
129C<*::ConfigData> modules, that contain local configuration information for
130their parent modules.)
131
6c7deadb
RGS
132=head1 Documentation
133
6c20a8f9
RGS
134=head2 New manpage, perlpragma
135
473aa102 136The L<perlpragma> manpage documents how to write one's own lexical
36d7017e
RGS
137pragmas in pure Perl (something that is possible only starting with
1385.9.4).
473aa102 139
6c20a8f9
RGS
140=head2 New manpage, perlreguts
141
473aa102
RGS
142The L<perlreguts> manpage, due to Yves Orton, describes internals of the
143Perl regular expression engine.
144
6c20a8f9
RGS
145=head2 New manpage, perlunitut
146
473aa102
RGS
147The L<perlunitut> manpage is an tutorial for programming with Unicode and
148string encodings in Perl, due to Juerd Waalboer.
149
6c7deadb
RGS
150=head1 Performance Enhancements
151
ffb08095
RGS
152=head2 Memory optimisations
153
21a732f3
RGS
154Several internal data structures (typeglobs, GVs, CVs, formats) have been
155restructured to use less memory. (Nicholas Clark)
156
ffb08095
RGS
157=head2 UTF-8 cache optimisation
158
21a732f3
RGS
159The UTF-8 caching code is now more efficient, and used more often.
160(Nicholas Clark)
161
ffb08095
RGS
162=head2 Regular expressions
163
164=over 4
165
166=item Engine de-recursiveized
167
168The regular expression engine is no longer recursive, meaning that
169patterns that used to overflow the stack will either die with useful
170explanations, or run to completion, which, since they were able to blow
171the stack before, will likely take a very long time to happen. If you were
172experiencing the occasional stack overflow (or segfault) and upgrade to
173discover that now perl apparently hangs instead, look for a degenerate
174regex.
175
176=item Single char char-classes treated as literals
177
178Classes of a single character are now treated the same as if the
179character had been used as a literal, meaning that code that uses
180char-classes as an escaping mechanism will see a speedup.
181
182=item Trie optimisation of literal string alternations
183
184Alternations, where possible, are optimised into more efficient matching
185structures. String literal alternations are merged into a trie and are
186matched simultaneously. This means that instead of O(N) time for matching
187N alternations at a given point the new code performs in O(1) time.
188
189B<Note:> Much code exists that works around perl's historic poor
190performance on alternations. Often the tricks used to do so will disable
191the new optimisations. Hopefully the utility modules used for this purpose
192will be educated about these new optimisations by the time 5.10 is
193released.
194
195=item Aho-Corasick start-point optimisation
196
197When a pattern starts with a trie-able alternation and there aren't
198better optimisations available the regex engine will use Aho-Corasick
199matching to find the start point.
200
201=back
6c20a8f9 202
6c7deadb
RGS
203=head1 Installation and Configuration Improvements
204
21a732f3
RGS
205=head2 Relocatable installations
206
207TODO
208
ddc61b51
RGS
209=head2 Ports
210
473aa102
RGS
211Many improvements have been made towards making Perl work correctly on
212z/OS.
213
3c1cb5e0
RGS
214Perl has been reported to work on DragonFlyBSD.
215
ddc61b51
RGS
216=head2 Compilation improvements
217
218All F<ppport.h> files in the XS modules bundled with perl are now
21a732f3 219autogenerated at build time. (Marcus Holland-Moritz)
ddc61b51
RGS
220
221=head2 New probes
222
3c1cb5e0 223The configuration process now detects whether strlcat() and strlcpy() are
ddc61b51
RGS
224available. When they are not available, perl's own version is used (from
225Russ Allbery's public domain implementation). Various places in the perl
21a732f3 226interpreter now uses them. (Steve Peters)
ddc61b51 227
6c7deadb
RGS
228=head1 Selected Bug Fixes
229
473aa102
RGS
230=head2 PERL5SHELL and tainting
231
21a732f3
RGS
232On Windows, PERL5SHELL is now checked for taintedness. (Rafael
233Garcia-Suarez)
473aa102
RGS
234
235=head2 Using *FILE{IO}
236
237C<stat()> and C<-X> filetests now treat *FILE{IO} filehandles like *FILE
21a732f3
RGS
238filehandles. (Steve Peters)
239
240=head2 Overloading and reblessing
241
242Overloading now works when references are reblessed into another class.
243Internally, this has been implemented by moving the flag for "overloading"
244from the reference to the referent, which logically is where it should
245always have been. (Nicholas Clark)
246
247=head2 Overloading and UTF-8
248
249A few bugs related to UTF-8 handling with objects that have
250stringification overloaded have been fixed. (Nicholas Clark)
473aa102 251
6c7deadb
RGS
252=head1 New or Changed Diagnostics
253
21a732f3
RGS
254=over 4
255
256=item State variable %s will be reinitialized
257
258One can assign initial values to state variables, but not when they're
259declared as a sub-part of a list assignment. See L<perldiag>.
260
261=back
262
6c7deadb
RGS
263=head1 Changed Internals
264
3c1cb5e0
RGS
265A new file, F<mathoms.c>, contains functions that aren't used anymore in
266the perl core, but that remain around because modules out there might
267still use them. They come from a factorization effort: for example, many
268PP functions are now shared for several ops.
6c20a8f9 269
6c7deadb
RGS
270=head1 Known Problems
271
3c1cb5e0
RGS
272One warning test (number 263 in F<lib/warnings.t>) fails under UTF-8
273locales.
274
275Bytecode tests fails under several platforms. Support for byteloader and
276compiler is considered to be removed before the 5.10.0 release.
6c7deadb 277
d06a6528
RGS
278=head2 Platform-specific Problems
279
280The test F<ext/Socket/t/socketpair.t> crashes after completing all tests
281successfully when built with USE_ITHREADS and PERL_IMPLICIT_SYS on Win32.
282
6c7deadb
RGS
283=head1 Reporting Bugs
284
285If you find what you think is a bug, you might check the articles
286recently posted to the comp.lang.perl.misc newsgroup and the perl
36d7017e 287bug database at http://rt.perl.org/rt3/ . There may also be
6c7deadb
RGS
288information at http://www.perl.org/ , the Perl Home Page.
289
290If you believe you have an unreported bug, please run the B<perlbug>
291program included with your release. Be sure to trim your bug down
292to a tiny but sufficient test case. Your bug report, along with the
293output of C<perl -V>, will be sent off to perlbug@perl.org to be
294analysed by the Perl porting team.
295
296=head1 SEE ALSO
297
298The F<Changes> file for exhaustive details on what changed.
299
300The F<INSTALL> file for how to build Perl.
301
302The F<README> file for general stuff.
303
304The F<Artistic> and F<Copying> files for copyright information.
305
306=cut