* fix a perlop fix from debian: http://bugs.debian.org/514814
[p5sagit/p5-mst-13.2.git] / pod / perl595delta.pod
CommitLineData
f6eae373 1=head1 NAME
2
70693193 3perl595delta - what is new for perl v5.9.5
f6eae373 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
20ee07fb 14=head2 Tainting and printf
15
16When perl is run under taint mode, C<printf()> and C<sprintf()> will now
3f10c77a 17reject any tainted format argument. (Rafael Garcia-Suarez)
20ee07fb 18
54a37cc6 19=head2 undef and signal handlers
20
21Undefining or deleting a signal handler via C<undef $SIG{FOO}> is now
97f820fb 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.)
54a37cc6 32
74bb26f2 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
00880d60 38=head2 Pseudo-hashes have been removed
39
40Support for pseudo-hashes has been removed from Perl 5.9. (The C<fields>
41pragma remains here, but uses an alternate implementation.)
42
73966613 43=head2 Removal of the bytecode compiler and of perlcc
44
45C<perlcc>, the byteloader and the supporting modules (B::C, B::CC,
46B::Bytecode, etc.) are no longer distributed with the perl sources. Those
47experimental tools have never worked reliably, and, due to the lack of
48volunteers to keep them in line with the perl interpreter developments, it
49was decided to remove them instead of shipping a broken version of those.
50The last version of those modules can be found with perl 5.9.4.
51
52However the B compiler framework stays supported in the perl core, as with
53the more useful modules it has permitted (among others, B::Deparse and
54B::Concise).
55
56=head2 Removal of the JPL
57
58The JPL (Java-Perl Linguo) has been removed from the perl sources tarball.
59
afa2ea4a 60=head2 Recursive inheritance detected earlier
61
62Perl will now immediately throw an exception if you modify any package's
63C<@ISA> in such a way that it would cause recursive inheritance.
64
65Previously, the exception would not occur until Perl attempted to make
66use of the recursive inheritance while resolving a method or doing a
67C<$foo-E<gt>isa($bar)> lookup.
68
f6eae373 69=head1 Core Enhancements
70
072f65b4 71=head2 Regular expressions
72
73=over 4
74
75=item Recursive Patterns
76
77It is now possible to write recursive patterns without using the C<(??{})>
78construct. This new way is more efficient, and in many cases easier to
79read.
80
81Each capturing parenthesis can now be treated as an independent pattern
82that can be entered by using the C<(?PARNO)> syntax (C<PARNO> standing for
83"parenthesis number"). For example, the following pattern will match
84nested balanced angle brackets:
85
86 /
87 ^ # start of line
88 ( # start capture buffer 1
89 < # match an opening angle bracket
90 (?: # match one of:
91 (?> # don't backtrack over the inside of this group
92 [^<>]+ # one or more non angle brackets
93 ) # end non backtracking group
94 | # ... or ...
95 (?1) # recurse to bracket 1 and try it again
96 )* # 0 or more times.
97 > # match a closing angle bracket
98 ) # end capture buffer one
99 $ # end of line
100 /x
101
102Note, users experienced with PCRE will find that the Perl implementation
103of this feature differs from the PCRE one in that it is possible to
104backtrack into a recursed pattern, whereas in PCRE the recursion is
73966613 105atomic or "possessive" in nature. (Yves Orton)
072f65b4 106
107=item Named Capture Buffers
108
109It is now possible to name capturing parenthesis in a pattern and refer to
110the captured contents by name. The naming syntax is C<< (?<NAME>....) >>.
111It's possible to backreference to a named buffer with the C<< \k<NAME> >>
97f820fb 112syntax. In code, the new magical hashes C<%+> and C<%-> can be used to
113access the contents of the capture buffers.
072f65b4 114
115Thus, to replace all doubled chars, one could write
116
117 s/(?<letter>.)\k<letter>/$+{letter}/g
118
97f820fb 119Only buffers with defined contents will be "visible" in the C<%+> hash, so
072f65b4 120it's possible to do something like
121
122 foreach my $name (keys %+) {
123 print "content of buffer '$name' is $+{$name}\n";
124 }
125
97f820fb 126The C<%-> hash is a bit more complete, since it will contain array refs
127holding values from all capture buffers similarly named, if there should
128be many of them.
129
130C<%+> and C<%-> are implemented as tied hashes through the new module
80305961 131C<Tie::Hash::NamedCapture>.
97f820fb 132
072f65b4 133Users exposed to the .NET regex engine will find that the perl
134implementation differs in that the numerical ordering of the buffers
135is sequential, and not "unnamed first, then named". Thus in the pattern
136
137 /(A)(?<B>B)(C)(?<D>D)/
138
139$1 will be 'A', $2 will be 'B', $3 will be 'C' and $4 will be 'D' and not
140$1 is 'A', $2 is 'C' and $3 is 'B' and $4 is 'D' that a .NET programmer
73966613 141would expect. This is considered a feature. :-) (Yves Orton)
072f65b4 142
b9b4dddf 143=item Possessive Quantifiers
144
ee9b8eae 145Perl now supports the "possessive quantifier" syntax of the "atomic match"
b9b4dddf 146pattern. Basically a possessive quantifier matches as much as it can and never
ee9b8eae 147gives any back. Thus it can be used to control backtracking. The syntax is
b9b4dddf 148similar to non-greedy matching, except instead of using a '?' as the modifier
149the '+' is used. Thus C<?+>, C<*+>, C<++>, C<{min,max}+> are now legal
73966613 150quantifiers. (Yves Orton)
b9b4dddf 151
24b23f37 152=item Backtracking control verbs
153
3f10c77a 154The regex engine now supports a number of special-purpose backtrack
5d458dd8 155control verbs: (*THEN), (*PRUNE), (*MARK), (*SKIP), (*COMMIT), (*FAIL)
c74340f9 156and (*ACCEPT). See L<perlre> for their descriptions. (Yves Orton)
157
158=item Relative backreferences
159
2bf803e2 160A new syntax C<\g{N}> or C<\gN> where "N" is a decimal integer allows a
161safer form of back-reference notation as well as allowing relative
162backreferences. This should make it easier to generate and embed patterns
3f10c77a 163that contain backreferences. See L<perlre/"Capture buffers">. (Yves Orton)
24b23f37 164
97f820fb 165=item C<\K> escape
ee9b8eae 166
167The functionality of Jeff Pinyan's module Regexp::Keep has been added to
168the core. You can now use in regular expressions the special escape C<\K>
169as a way to do something like floating length positive lookbehind. It is
170also useful in substitutions like:
171
172 s/(foo)bar/$1/g
173
174that can now be converted to
175
176 s/foo\Kbar//g
177
97f820fb 178which is much more efficient. (Yves Orton)
ee9b8eae 179
41b9272f 180=item Vertical and horizontal whitespace, and linebreak
181
182Regular expressions now recognize the C<\v> and C<\h> escapes, that match
183vertical and horizontal whitespace, respectively. C<\V> and C<\H>
184logically match their complements.
185
329d35d1 186C<\R> matches a generic linebreak, that is, vertical whitespace, plus
41b9272f 187the multi-character sequence C<"\x0D\x0A">.
188
75c442e4 189=back
190
d5494b07 191=head2 The C<_> prototype
192
193A new prototype character has been added. C<_> is equivalent to C<$> (it
194denotes a scalar), but defaults to C<$_> if the corresponding argument
195isn't supplied. Due to the optional nature of the argument, you can only
196use it at the end of a prototype, or before a semicolon.
197
73966613 198This has a small incompatible consequence: the prototype() function has
199been adjusted to return C<_> for some built-ins in appropriate cases (for
97f820fb 200example, C<prototype('CORE::rmdir')>). (Rafael)
73966613 201
49f595a6 202=head2 UNITCHECK blocks
203
204C<UNITCHECK>, a new special code block has been introduced, in addition to
205C<BEGIN>, C<CHECK>, C<INIT> and C<END>.
206
207C<CHECK> and C<INIT> blocks, while useful for some specialized purposes,
208are always executed at the transition between the compilation and the
209execution of the main program, and thus are useless whenever code is
210loaded at runtime. On the other hand, C<UNITCHECK> blocks are executed
211just after the unit which defined them has been compiled. See L<perlmod>
212for more information. (Alex Gough)
213
5a093634 214=head2 readpipe() is now overridable
215
216The built-in function readpipe() is now overridable. Overriding it permits
74bb26f2 217also to override its operator counterpart, C<qx//> (a.k.a. C<``>).
218Moreover, it now defaults to C<$_> if no argument is provided. (Rafael)
219
220=head2 default argument for readline()
221
222readline() now defaults to C<*ARGV> if no argument is provided. (Rafael)
5a093634 223
73966613 224=head2 UCD 5.0.0
225
226The copy of the Unicode Character Database included in Perl 5.9 has
227been updated to version 5.0.0.
228
97f820fb 229=head2 Smart match
230
231The smart match operator (C<~~>) is now available by default (you don't
232need to enable it with C<use feature> any longer). (Michael G Schwern)
233
74bb26f2 234=head2 Implicit loading of C<feature>
235
236The C<feature> pragma is now implicitly loaded when you require a minimal
237perl version (with the C<use VERSION> construct) greater than, or equal
238to, 5.9.5.
239
f6eae373 240=head1 Modules and Pragmas
241
74bb26f2 242=head2 New Pragma, C<mro>
243
244A new pragma, C<mro> (for Method Resolution Order) has been added. It
245permits to switch, on a per-class basis, the algorithm that perl uses to
353c6505 246find inherited methods in case of a multiple inheritance hierarchy. The
74bb26f2 247default MRO hasn't changed (DFS, for Depth First Search). Another MRO is
248available: the C3 algorithm. See L<mro> for more information.
249(Brandon Black)
250
353c6505 251Note that, due to changes in the implementation of class hierarchy search,
91ddf7c8 252code that used to undef the C<*ISA> glob will most probably break. Anyway,
253undef'ing C<*ISA> had the side-effect of removing the magic on the @ISA
254array and should not have been done in the first place.
255
3284ac36 256=head2 bignum, bigint, bigrat
257
258The three numeric pragmas C<bignum>, C<bigint> and C<bigrat> are now
259lexically scoped. (Tels)
260
107590b9 261=head2 Math::BigInt/Math::BigFloat
262
263Many bugs have been fixed; noteworthy are comparisons with NaN, which
264no longer warn about undef values.
265
266The following things are new:
267
268=over 4
269
270=item config()
271
272The config() method now also supports the calling-style
273C<< config('lib') >> in addition to C<< config()->{'lib'} >>.
274
275=item import()
276
277Upon import, using C<< lib => 'Foo' >> now warns if the low-level library
278cannot be found. To suppress the warning, you can use C<< try => 'Foo' >>
279instead. To convert the warning into a die, use C<< only => 'Foo' >>
280instead.
281
282=item roundmode common
283
284A rounding mode of C<common> is now supported.
285
286=back
287
288Also, support for the following methods has been added:
289
290=over 4
291
292=item bpi(), bcos(), bsin(), batan(), batan2()
293
294=item bmuladd()
295
296=item bexp(), bnok()
297
298=item from_hex(), from_oct(), and from_bin()
299
300=item as_oct()
301
302=back
303
304In addition, the default math-backend (Calc (Perl) and FastCalc (XS)) now
305support storing numbers in parts with 9 digits instead of 7 on Perls with
306either 64bit integer or long double support. This means math operations
307scale better and are thus faster for really big numbers.
308
f6eae373 309=head2 New Core Modules
310
73966613 311=over 4
312
313=item *
314
315C<Locale::Maketext::Simple>, needed by CPANPLUS, is a simple wrapper around
316C<Locale::Maketext::Lexicon>. Note that C<Locale::Maketext::Lexicon> isn't
317included in the perl core; the behaviour of C<Locale::Maketext::Simple>
318gracefully degrades when the later isn't present.
319
320=item *
321
322C<Params::Check> implements a generic input parsing/checking mechanism. It
323is used by CPANPLUS.
324
5a093634 325=item *
326
327C<Term::UI> simplifies the task to ask questions at a terminal prompt.
328
329=item *
330
331C<Object::Accessor> provides an interface to create per-object accessors.
332
97f820fb 333=item *
334
335C<Module::Pluggable> is a simple framework to create modules that accept
336pluggable sub-modules.
337
338=item *
339
340C<Module::Load::Conditional> provides simple ways to query and possibly
341load installed modules.
342
343=item *
344
345C<Time::Piece> provides an object oriented interface to time functions,
346overriding the built-ins localtime() and gmtime().
347
348=item *
349
350C<IPC::Cmd> helps to find and run external commands, possibly
351interactively.
352
353=item *
354
355C<File::Fetch> provide a simple generic file fetching mechanism.
356
357=item *
358
201a0ee1 359C<Log::Message> and C<Log::Message::Simple> are used by the log facility
360of C<CPANPLUS>.
361
362=item *
363
97f820fb 364C<Archive::Extract> is a generic archive extraction mechanism
365for F<.tar> (plain, gziped or bzipped) or F<.zip> files.
366
74bb26f2 367=item *
368
369C<CPANPLUS> provides an API and a command-line tool to access the CPAN
370mirrors.
371
73966613 372=back
373
d5494b07 374=head2 Module changes
375
376=over 4
377
ddf4dafe 378=item C<assertions>
379
380The C<assertions> pragma, its submodules C<assertions::activate> and
381C<assertions::compat> and the B<-A> command-line switch have been removed.
382The interface was not judged mature enough for inclusion in a stable
383release.
384
d5494b07 385=item C<base>
386
387The C<base> pragma now warns if a class tries to inherit from itself.
97f820fb 388(Curtis "Ovid" Poe)
d5494b07 389
74bb26f2 390=item C<strict> and C<warnings>
391
392C<strict> and C<warnings> will now complain loudly if they are loaded via
393incorrect casing (as in C<use Strict;>). (Johan Vromans)
394
18857c0b 395=item C<warnings>
396
397The C<warnings> pragma doesn't load C<Carp> anymore. That means that code
398that used C<Carp> routines without having loaded it at compile time might
399need to be adjusted; typically, the following (faulty) code won't work
400anymore, and will require parentheses to be added after the function name:
401
402 use warnings;
403 require Carp;
404 Carp::confess "argh";
405
97f820fb 406=item C<less>
407
408C<less> now does something useful (or at least it tries to). In fact, it
409has been turned into a lexical pragma. So, in your modules, you can now
410test whether your users have requested to use less CPU, or less memory,
411less magic, or maybe even less fat. See L<less> for more. (Joshua ben
412Jore)
413
3f10c77a 414=item C<Attribute::Handlers>
415
416C<Attribute::Handlers> can now report the caller's file and line number.
417(David Feldman)
418
97f820fb 419=item C<B::Lint>
420
421C<B::Lint> is now based on C<Module::Pluggable>, and so can be extended
422with plugins. (Joshua ben Jore)
423
424=item C<B>
425
426It's now possible to access the lexical pragma hints (C<%^H>) by using the
427method B::COP::hints_hash(). It returns a C<B::RHE> object, which in turn
428can be used to get a hash reference via the method B::RHE::HASH(). (Joshua
429ben Jore)
430
431=for p5p XXX document this in B.pm too
432
ab4e6221 433=item C<Thread>
434
435As the old 5005thread threading model has been removed, in favor of the
436ithreads scheme, the C<Thread> module is now a compatibility wrapper, to
68e109b8 437be used in old code only. It has been removed from the default list of
438dynamic extensions.
ab4e6221 439
d5494b07 440=back
441
f6eae373 442=head1 Utility Changes
443
74bb26f2 444=head2 C<cpanp>
445
446C<cpanp>, the CPANPLUS shell, has been added. (C<cpanp-run-perl>, an
447helper for CPANPLUS operation, has been added too, but isn't intended for
448direct use).
449
8a499140 450=head2 C<cpan2dist>
451
452C<cpan2dist> is a new utility, that comes with CPANPLUS. It's a tool to
453create distributions (or packages) from CPAN modules.
454
74bb26f2 455=head2 C<pod2html>
456
457The output of C<pod2html> has been enhanced to be more customizable via
458CSS. Some formatting problems were also corrected. (Jari Aalto)
459
f6eae373 460=head1 Documentation
461
74bb26f2 462=head2 New manpage, perlunifaq
463
464A new manual page, L<perlunifaq> (the Perl Unicode FAQ), has been added
465(Juerd Waalboer).
466
f6eae373 467=head1 Installation and Configuration Improvements
468
73966613 469=head2 C++ compatibility
470
471Efforts have been made to make perl and the core XS modules compilable
472with various C++ compilers (although the situation is not perfect with
473some of the compilers on some of the platforms tested.)
474
ab4e6221 475=head2 Visual C++
476
477Perl now can be compiled with Microsoft Visual C++ 2005.
478
3f10c77a 479=head2 Static build on Win32
480
481It's now possible to build a C<perl-static.exe> that doesn't depend
482on C<perl59.dll> on Win32. See the Win32 makefiles for details.
e3c82801 483(Vadim Konovalov)
3f10c77a 484
68e109b8 485=head2 win32 builds
486
487All win32 builds (MS-Win, WinCE) have been merged and cleaned up.
488
489=head2 C<d_pseudofork> and C<d_printf_format_null>
ab4e6221 490
491A new configuration variable, available as C<$Config{d_pseudofork}> in
492the L<Config> module, has been added, to distinguish real fork() support
493from fake pseudofork used on Windows platforms.
494
68e109b8 495A new configuration variable, C<d_printf_format_null>, has been added,
496to see if printf-like formats are allowed to be NULL.
497
498=head2 Help
499
500C<Configure -h> has been extended with the most used option.
501
502Much less 'Whoa there' messages.
503
504=head2 64bit systems
505
506Better detection of 64bit(only) systems, and setting all the (library)
507paths accordingly.
508
73966613 509=head2 Ports
510
511Perl has been reported to work on MidnightBSD.
512
68e109b8 513Support for Cray XT4 Catamount/Qk has been added.
514
515Vendor patches have been merged for RedHat and GenToo.
516
f6eae373 517=head1 Selected Bug Fixes
518
49f595a6 519PerlIO::scalar will now prevent writing to read-only scalars. Moreover,
520seek() is now supported with PerlIO::scalar-based filehandles, the
97f820fb 521underlying string being zero-filled as needed. (Rafael, Jarkko Hietaniemi)
73966613 522
523study() never worked for UTF-8 strings, but could lead to false results.
524It's now a no-op on UTF-8 data. (Yves Orton)
525
49f595a6 526The signals SIGILL, SIGBUS and SIGSEGV are now always delivered in an
527"unsafe" manner (contrary to other signals, that are deferred until the
528perl interpreter reaches a reasonably stable state; see
97f820fb 529L<perlipc/"Deferred Signals (Safe Signals)">). (Rafael)
49f595a6 530
5a093634 531When a module or a file is loaded through an @INC-hook, and when this hook
532has set a filename entry in %INC, __FILE__ is now set for this module
97f820fb 533accordingly to the contents of that %INC entry. (Rafael)
534
535The C<-w> and C<-t> switches can now be used together without messing
536up what categories of warnings are activated or not. (Rafael)
5a093634 537
74bb26f2 538Duping a filehandle which has the C<:utf8> PerlIO layer set will now
539properly carry that layer on the duped filehandle. (Rafael)
540
37a7450d 541Localizing an hash element whose key was given as a variable didn't work
21e0a455 542correctly if the variable was changed while the local() was in effect (as
543in C<local $h{$x}; ++$x>). (Bo Lindbergh)
37a7450d 544
f6eae373 545=head1 New or Changed Diagnostics
546
74bb26f2 547=head2 Deprecations
548
549Two deprecation warnings have been added: (Rafael)
550
551 Opening dirhandle %s also as a file
552 Opening filehandle %s also as a directory
553
f6eae373 554=head1 Changed Internals
555
73966613 556The anonymous hash and array constructors now take 1 op in the optree
557instead of 3, now that pp_anonhash and pp_anonlist return a reference to
558an hash/array when the op is flagged with OPf_SPECIAL (Nicholas Clark).
559
97f820fb 560=for p5p XXX have we some docs on how to create regexp engine plugins, since that's now possible ? (perlreguts)
561
562=for p5p XXX new BIND SV type, #29544, #29642
563
f6eae373 564=head1 Reporting Bugs
565
566If you find what you think is a bug, you might check the articles
567recently posted to the comp.lang.perl.misc newsgroup and the perl
568bug database at http://rt.perl.org/rt3/ . There may also be
569information at http://www.perl.org/ , the Perl Home Page.
570
571If you believe you have an unreported bug, please run the B<perlbug>
572program included with your release. Be sure to trim your bug down
573to a tiny but sufficient test case. Your bug report, along with the
574output of C<perl -V>, will be sent off to perlbug@perl.org to be
575analysed by the Perl porting team.
576
577=head1 SEE ALSO
578
579The F<Changes> file for exhaustive details on what changed.
580
581The F<INSTALL> file for how to build Perl.
582
583The F<README> file for general stuff.
584
585The F<Artistic> and F<Copying> files for copyright information.
586
587=cut