This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
RE: [PATCH] Skip ext/Win32/t/Unicode.t under Cygwin
[perl5.git] / pod / perl595delta.pod
... / ...
CommitLineData
1=head1 NAME
2
3perldelta - what is new for perl v5.9.5
4
5=head1 DESCRIPTION
6
7This document describes differences between the 5.9.4 and the 5.9.5
8development releases. See L<perl590delta>, L<perl591delta>,
9L<perl592delta>, L<perl593delta> and L<perl594delta> for the differences
10between 5.8.0 and 5.9.4.
11
12=head1 Incompatible Changes
13
14=head2 Tainting and printf
15
16When perl is run under taint mode, C<printf()> and C<sprintf()> will now
17reject any tainted format argument. (Rafael Garcia-Suarez)
18
19=head2 undef and signal handlers
20
21Undefining or deleting a signal handler via C<undef $SIG{FOO}> is now
22equivalent to setting it to C<'DEFAULT'>. (Rafael)
23
24=head2 strictures and array/hash dereferencing in defined()
25
26C<defined @$foo> and C<defined %$bar> are now subject to C<strict 'refs'>
27(that is, C<$foo> and C<$bar> shall be proper references there.)
28(Nicholas Clark)
29
30(However, C<defined(@foo)> and C<defined(%bar)> are discouraged constructs
31anyway.)
32
33=head2 C<(?p{})> has been removed
34
35The regular expression construct C<(?p{})>, which was deprecated in perl
365.8, has been removed. Use C<(??{})> instead. (Rafael)
37
38=head2 Removal of the bytecode compiler and of perlcc
39
40C<perlcc>, the byteloader and the supporting modules (B::C, B::CC,
41B::Bytecode, etc.) are no longer distributed with the perl sources. Those
42experimental tools have never worked reliably, and, due to the lack of
43volunteers to keep them in line with the perl interpreter developments, it
44was decided to remove them instead of shipping a broken version of those.
45The last version of those modules can be found with perl 5.9.4.
46
47However the B compiler framework stays supported in the perl core, as with
48the more useful modules it has permitted (among others, B::Deparse and
49B::Concise).
50
51=head2 Removal of the JPL
52
53The JPL (Java-Perl Linguo) has been removed from the perl sources tarball.
54
55=head1 Core Enhancements
56
57=head2 Regular expressions
58
59=over 4
60
61=item Recursive Patterns
62
63It is now possible to write recursive patterns without using the C<(??{})>
64construct. This new way is more efficient, and in many cases easier to
65read.
66
67Each capturing parenthesis can now be treated as an independent pattern
68that can be entered by using the C<(?PARNO)> syntax (C<PARNO> standing for
69"parenthesis number"). For example, the following pattern will match
70nested balanced angle brackets:
71
72 /
73 ^ # start of line
74 ( # start capture buffer 1
75 < # match an opening angle bracket
76 (?: # match one of:
77 (?> # don't backtrack over the inside of this group
78 [^<>]+ # one or more non angle brackets
79 ) # end non backtracking group
80 | # ... or ...
81 (?1) # recurse to bracket 1 and try it again
82 )* # 0 or more times.
83 > # match a closing angle bracket
84 ) # end capture buffer one
85 $ # end of line
86 /x
87
88Note, users experienced with PCRE will find that the Perl implementation
89of this feature differs from the PCRE one in that it is possible to
90backtrack into a recursed pattern, whereas in PCRE the recursion is
91atomic or "possessive" in nature. (Yves Orton)
92
93=item Named Capture Buffers
94
95It is now possible to name capturing parenthesis in a pattern and refer to
96the captured contents by name. The naming syntax is C<< (?<NAME>....) >>.
97It's possible to backreference to a named buffer with the C<< \k<NAME> >>
98syntax. In code, the new magical hashes C<%+> and C<%-> can be used to
99access the contents of the capture buffers.
100
101Thus, to replace all doubled chars, one could write
102
103 s/(?<letter>.)\k<letter>/$+{letter}/g
104
105Only buffers with defined contents will be "visible" in the C<%+> hash, so
106it's possible to do something like
107
108 foreach my $name (keys %+) {
109 print "content of buffer '$name' is $+{$name}\n";
110 }
111
112The C<%-> hash is a bit more complete, since it will contain array refs
113holding values from all capture buffers similarly named, if there should
114be many of them.
115
116C<%+> and C<%-> are implemented as tied hashes through the new module
117C<Tie::Hash::NamedCapture>.
118
119Users exposed to the .NET regex engine will find that the perl
120implementation differs in that the numerical ordering of the buffers
121is sequential, and not "unnamed first, then named". Thus in the pattern
122
123 /(A)(?<B>B)(C)(?<D>D)/
124
125$1 will be 'A', $2 will be 'B', $3 will be 'C' and $4 will be 'D' and not
126$1 is 'A', $2 is 'C' and $3 is 'B' and $4 is 'D' that a .NET programmer
127would expect. This is considered a feature. :-) (Yves Orton)
128
129=item Possessive Quantifiers
130
131Perl now supports the "possessive quantifier" syntax of the "atomic match"
132pattern. Basically a possessive quantifier matches as much as it can and never
133gives any back. Thus it can be used to control backtracking. The syntax is
134similar to non-greedy matching, except instead of using a '?' as the modifier
135the '+' is used. Thus C<?+>, C<*+>, C<++>, C<{min,max}+> are now legal
136quantifiers. (Yves Orton)
137
138=item Backtracking control verbs
139
140The regex engine now supports a number of special-purpose backtrack
141control verbs: (*THEN), (*PRUNE), (*MARK), (*SKIP), (*COMMIT), (*FAIL)
142and (*ACCEPT). See L<perlre> for their descriptions. (Yves Orton)
143
144=item Relative backreferences
145
146A new syntax C<\g{N}> or C<\gN> where "N" is a decimal integer allows a
147safer form of back-reference notation as well as allowing relative
148backreferences. This should make it easier to generate and embed patterns
149that contain backreferences. See L<perlre/"Capture buffers">. (Yves Orton)
150
151=item C<\K> escape
152
153The functionality of Jeff Pinyan's module Regexp::Keep has been added to
154the core. You can now use in regular expressions the special escape C<\K>
155as a way to do something like floating length positive lookbehind. It is
156also useful in substitutions like:
157
158 s/(foo)bar/$1/g
159
160that can now be converted to
161
162 s/foo\Kbar//g
163
164which is much more efficient. (Yves Orton)
165
166=back
167
168=head2 The C<_> prototype
169
170A new prototype character has been added. C<_> is equivalent to C<$> (it
171denotes a scalar), but defaults to C<$_> if the corresponding argument
172isn't supplied. Due to the optional nature of the argument, you can only
173use it at the end of a prototype, or before a semicolon.
174
175This has a small incompatible consequence: the prototype() function has
176been adjusted to return C<_> for some built-ins in appropriate cases (for
177example, C<prototype('CORE::rmdir')>). (Rafael)
178
179=head2 UNITCHECK blocks
180
181C<UNITCHECK>, a new special code block has been introduced, in addition to
182C<BEGIN>, C<CHECK>, C<INIT> and C<END>.
183
184C<CHECK> and C<INIT> blocks, while useful for some specialized purposes,
185are always executed at the transition between the compilation and the
186execution of the main program, and thus are useless whenever code is
187loaded at runtime. On the other hand, C<UNITCHECK> blocks are executed
188just after the unit which defined them has been compiled. See L<perlmod>
189for more information. (Alex Gough)
190
191=head2 readpipe() is now overridable
192
193The built-in function readpipe() is now overridable. Overriding it permits
194also to override its operator counterpart, C<qx//> (a.k.a. C<``>).
195Moreover, it now defaults to C<$_> if no argument is provided. (Rafael)
196
197=head2 default argument for readline()
198
199readline() now defaults to C<*ARGV> if no argument is provided. (Rafael)
200
201=head2 UCD 5.0.0
202
203The copy of the Unicode Character Database included in Perl 5.9 has
204been updated to version 5.0.0.
205
206=head2 Smart match
207
208The smart match operator (C<~~>) is now available by default (you don't
209need to enable it with C<use feature> any longer). (Michael G Schwern)
210
211=head2 Implicit loading of C<feature>
212
213The C<feature> pragma is now implicitly loaded when you require a minimal
214perl version (with the C<use VERSION> construct) greater than, or equal
215to, 5.9.5.
216
217=head1 Modules and Pragmas
218
219=head2 New Pragma, C<mro>
220
221A new pragma, C<mro> (for Method Resolution Order) has been added. It
222permits to switch, on a per-class basis, the algorithm that perl uses to
223find inherited methods in case of a mutiple inheritance hierachy. The
224default MRO hasn't changed (DFS, for Depth First Search). Another MRO is
225available: the C3 algorithm. See L<mro> for more information.
226(Brandon Black)
227
228=head2 New Core Modules
229
230=over 4
231
232=item *
233
234C<Locale::Maketext::Simple>, needed by CPANPLUS, is a simple wrapper around
235C<Locale::Maketext::Lexicon>. Note that C<Locale::Maketext::Lexicon> isn't
236included in the perl core; the behaviour of C<Locale::Maketext::Simple>
237gracefully degrades when the later isn't present.
238
239=item *
240
241C<Params::Check> implements a generic input parsing/checking mechanism. It
242is used by CPANPLUS.
243
244=item *
245
246C<Term::UI> simplifies the task to ask questions at a terminal prompt.
247
248=item *
249
250C<Object::Accessor> provides an interface to create per-object accessors.
251
252=item *
253
254C<Module::Pluggable> is a simple framework to create modules that accept
255pluggable sub-modules.
256
257=item *
258
259C<Module::Load::Conditional> provides simple ways to query and possibly
260load installed modules.
261
262=item *
263
264C<Time::Piece> provides an object oriented interface to time functions,
265overriding the built-ins localtime() and gmtime().
266
267=item *
268
269C<IPC::Cmd> helps to find and run external commands, possibly
270interactively.
271
272=item *
273
274C<File::Fetch> provide a simple generic file fetching mechanism.
275
276=item *
277
278C<Archive::Extract> is a generic archive extraction mechanism
279for F<.tar> (plain, gziped or bzipped) or F<.zip> files.
280
281=item *
282
283C<CPANPLUS> provides an API and a command-line tool to access the CPAN
284mirrors.
285
286=back
287
288=head2 Module changes
289
290=over 4
291
292=item C<base>
293
294The C<base> pragma now warns if a class tries to inherit from itself.
295(Curtis "Ovid" Poe)
296
297=item C<strict> and C<warnings>
298
299C<strict> and C<warnings> will now complain loudly if they are loaded via
300incorrect casing (as in C<use Strict;>). (Johan Vromans)
301
302=item C<warnings>
303
304The C<warnings> pragma doesn't load C<Carp> anymore. That means that code
305that used C<Carp> routines without having loaded it at compile time might
306need to be adjusted; typically, the following (faulty) code won't work
307anymore, and will require parentheses to be added after the function name:
308
309 use warnings;
310 require Carp;
311 Carp::confess "argh";
312
313=item C<less>
314
315C<less> now does something useful (or at least it tries to). In fact, it
316has been turned into a lexical pragma. So, in your modules, you can now
317test whether your users have requested to use less CPU, or less memory,
318less magic, or maybe even less fat. See L<less> for more. (Joshua ben
319Jore)
320
321=item C<Attribute::Handlers>
322
323C<Attribute::Handlers> can now report the caller's file and line number.
324(David Feldman)
325
326=item C<B::Lint>
327
328C<B::Lint> is now based on C<Module::Pluggable>, and so can be extended
329with plugins. (Joshua ben Jore)
330
331=item C<B>
332
333It's now possible to access the lexical pragma hints (C<%^H>) by using the
334method B::COP::hints_hash(). It returns a C<B::RHE> object, which in turn
335can be used to get a hash reference via the method B::RHE::HASH(). (Joshua
336ben Jore)
337
338=for p5p XXX document this in B.pm too
339
340=back
341
342=head1 Utility Changes
343
344=head2 C<cpanp>
345
346C<cpanp>, the CPANPLUS shell, has been added. (C<cpanp-run-perl>, an
347helper for CPANPLUS operation, has been added too, but isn't intended for
348direct use).
349
350=head2 C<pod2html>
351
352The output of C<pod2html> has been enhanced to be more customizable via
353CSS. Some formatting problems were also corrected. (Jari Aalto)
354
355=head1 Documentation
356
357=head2 New manpage, perlunifaq
358
359A new manual page, L<perlunifaq> (the Perl Unicode FAQ), has been added
360(Juerd Waalboer).
361
362=head1 Performance Enhancements
363
364=head1 Installation and Configuration Improvements
365
366=head2 C++ compatibility
367
368Efforts have been made to make perl and the core XS modules compilable
369with various C++ compilers (although the situation is not perfect with
370some of the compilers on some of the platforms tested.)
371
372=head2 Static build on Win32
373
374It's now possible to build a C<perl-static.exe> that doesn't depend
375on C<perl59.dll> on Win32. See the Win32 makefiles for details.
376(Vadim Konovalov)
377
378=head2 Ports
379
380Perl has been reported to work on MidnightBSD.
381
382=head1 Selected Bug Fixes
383
384PerlIO::scalar will now prevent writing to read-only scalars. Moreover,
385seek() is now supported with PerlIO::scalar-based filehandles, the
386underlying string being zero-filled as needed. (Rafael, Jarkko Hietaniemi)
387
388study() never worked for UTF-8 strings, but could lead to false results.
389It's now a no-op on UTF-8 data. (Yves Orton)
390
391The signals SIGILL, SIGBUS and SIGSEGV are now always delivered in an
392"unsafe" manner (contrary to other signals, that are deferred until the
393perl interpreter reaches a reasonably stable state; see
394L<perlipc/"Deferred Signals (Safe Signals)">). (Rafael)
395
396When a module or a file is loaded through an @INC-hook, and when this hook
397has set a filename entry in %INC, __FILE__ is now set for this module
398accordingly to the contents of that %INC entry. (Rafael)
399
400The C<-w> and C<-t> switches can now be used together without messing
401up what categories of warnings are activated or not. (Rafael)
402
403Duping a filehandle which has the C<:utf8> PerlIO layer set will now
404properly carry that layer on the duped filehandle. (Rafael)
405
406=head1 New or Changed Diagnostics
407
408=head2 Deprecations
409
410Two deprecation warnings have been added: (Rafael)
411
412 Opening dirhandle %s also as a file
413 Opening filehandle %s also as a directory
414
415=head1 Changed Internals
416
417The anonymous hash and array constructors now take 1 op in the optree
418instead of 3, now that pp_anonhash and pp_anonlist return a reference to
419an hash/array when the op is flagged with OPf_SPECIAL (Nicholas Clark).
420
421=for p5p XXX have we some docs on how to create regexp engine plugins, since that's now possible ? (perlreguts)
422
423=for p5p XXX new BIND SV type, #29544, #29642
424
425=head1 Known Problems
426
427=head2 Platform Specific Problems
428
429=head1 Reporting Bugs
430
431If you find what you think is a bug, you might check the articles
432recently posted to the comp.lang.perl.misc newsgroup and the perl
433bug database at http://rt.perl.org/rt3/ . There may also be
434information at http://www.perl.org/ , the Perl Home Page.
435
436If you believe you have an unreported bug, please run the B<perlbug>
437program included with your release. Be sure to trim your bug down
438to a tiny but sufficient test case. Your bug report, along with the
439output of C<perl -V>, will be sent off to perlbug@perl.org to be
440analysed by the Perl porting team.
441
442=head1 SEE ALSO
443
444The F<Changes> file for exhaustive details on what changed.
445
446The F<INSTALL> file for how to build Perl.
447
448The F<README> file for general stuff.
449
450The F<Artistic> and F<Copying> files for copyright information.
451
452=cut