3 perl595delta - what is new for perl v5.9.5
7 This document describes differences between the 5.9.4 and the 5.9.5
8 development releases. See L<perl590delta>, L<perl591delta>,
9 L<perl592delta>, L<perl593delta> and L<perl594delta> for the differences
10 between 5.8.0 and 5.9.4.
12 =head1 Incompatible Changes
14 =head2 Tainting and printf
16 When perl is run under taint mode, C<printf()> and C<sprintf()> will now
17 reject any tainted format argument. (Rafael Garcia-Suarez)
19 =head2 undef and signal handlers
21 Undefining or deleting a signal handler via C<undef $SIG{FOO}> is now
22 equivalent to setting it to C<'DEFAULT'>. (Rafael)
24 =head2 strictures and array/hash dereferencing in defined()
26 C<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.)
30 (However, C<defined(@foo)> and C<defined(%bar)> are discouraged constructs
33 =head2 C<(?p{})> has been removed
35 The regular expression construct C<(?p{})>, which was deprecated in perl
36 5.8, has been removed. Use C<(??{})> instead. (Rafael)
38 =head2 Pseudo-hashes have been removed
40 Support for pseudo-hashes has been removed from Perl 5.9. (The C<fields>
41 pragma remains here, but uses an alternate implementation.)
43 =head2 Removal of the bytecode compiler and of perlcc
45 C<perlcc>, the byteloader and the supporting modules (B::C, B::CC,
46 B::Bytecode, etc.) are no longer distributed with the perl sources. Those
47 experimental tools have never worked reliably, and, due to the lack of
48 volunteers to keep them in line with the perl interpreter developments, it
49 was decided to remove them instead of shipping a broken version of those.
50 The last version of those modules can be found with perl 5.9.4.
52 However the B compiler framework stays supported in the perl core, as with
53 the more useful modules it has permitted (among others, B::Deparse and
56 =head2 Removal of the JPL
58 The JPL (Java-Perl Linguo) has been removed from the perl sources tarball.
60 =head2 Recursive inheritance detected earlier
62 Perl will now immediately throw an exception if you modify any package's
63 C<@ISA> in such a way that it would cause recursive inheritance.
65 Previously, the exception would not occur until Perl attempted to make
66 use of the recursive inheritance while resolving a method or doing a
67 C<$foo-E<gt>isa($bar)> lookup.
69 =head1 Core Enhancements
71 =head2 Regular expressions
75 =item Recursive Patterns
77 It is now possible to write recursive patterns without using the C<(??{})>
78 construct. This new way is more efficient, and in many cases easier to
81 Each capturing parenthesis can now be treated as an independent pattern
82 that can be entered by using the C<(?PARNO)> syntax (C<PARNO> standing for
83 "parenthesis number"). For example, the following pattern will match
84 nested balanced angle brackets:
88 ( # start capture buffer 1
89 < # match an opening angle bracket
91 (?> # don't backtrack over the inside of this group
92 [^<>]+ # one or more non angle brackets
93 ) # end non backtracking group
95 (?1) # recurse to bracket 1 and try it again
97 > # match a closing angle bracket
98 ) # end capture buffer one
102 Note, users experienced with PCRE will find that the Perl implementation
103 of this feature differs from the PCRE one in that it is possible to
104 backtrack into a recursed pattern, whereas in PCRE the recursion is
105 atomic or "possessive" in nature. (Yves Orton)
107 =item Named Capture Buffers
109 It is now possible to name capturing parenthesis in a pattern and refer to
110 the captured contents by name. The naming syntax is C<< (?<NAME>....) >>.
111 It's possible to backreference to a named buffer with the C<< \k<NAME> >>
112 syntax. In code, the new magical hashes C<%+> and C<%-> can be used to
113 access the contents of the capture buffers.
115 Thus, to replace all doubled chars, one could write
117 s/(?<letter>.)\k<letter>/$+{letter}/g
119 Only buffers with defined contents will be "visible" in the C<%+> hash, so
120 it's possible to do something like
122 foreach my $name (keys %+) {
123 print "content of buffer '$name' is $+{$name}\n";
126 The C<%-> hash is a bit more complete, since it will contain array refs
127 holding values from all capture buffers similarly named, if there should
130 C<%+> and C<%-> are implemented as tied hashes through the new module
131 C<Tie::Hash::NamedCapture>.
133 Users exposed to the .NET regex engine will find that the perl
134 implementation differs in that the numerical ordering of the buffers
135 is sequential, and not "unnamed first, then named". Thus in the pattern
137 /(A)(?<B>B)(C)(?<D>D)/
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
141 would expect. This is considered a feature. :-) (Yves Orton)
143 =item Possessive Quantifiers
145 Perl now supports the "possessive quantifier" syntax of the "atomic match"
146 pattern. Basically a possessive quantifier matches as much as it can and never
147 gives any back. Thus it can be used to control backtracking. The syntax is
148 similar to non-greedy matching, except instead of using a '?' as the modifier
149 the '+' is used. Thus C<?+>, C<*+>, C<++>, C<{min,max}+> are now legal
150 quantifiers. (Yves Orton)
152 =item Backtracking control verbs
154 The regex engine now supports a number of special-purpose backtrack
155 control verbs: (*THEN), (*PRUNE), (*MARK), (*SKIP), (*COMMIT), (*FAIL)
156 and (*ACCEPT). See L<perlre> for their descriptions. (Yves Orton)
158 =item Relative backreferences
160 A new syntax C<\g{N}> or C<\gN> where "N" is a decimal integer allows a
161 safer form of back-reference notation as well as allowing relative
162 backreferences. This should make it easier to generate and embed patterns
163 that contain backreferences. See L<perlre/"Capture buffers">. (Yves Orton)
167 The functionality of Jeff Pinyan's module Regexp::Keep has been added to
168 the core. You can now use in regular expressions the special escape C<\K>
169 as a way to do something like floating length positive lookbehind. It is
170 also useful in substitutions like:
174 that can now be converted to
178 which is much more efficient. (Yves Orton)
180 =item Vertical and horizontal whitespace, and linebreak
182 Regular expressions now recognize the C<\v> and C<\h> escapes, that match
183 vertical and horizontal whitespace, respectively. C<\V> and C<\H>
184 logically match their complements.
186 C<\R> matches a generic linebreak, that is, vertical whitespace, plus
187 the multi-character sequence C<"\x0D\x0A">.
191 =head2 The C<_> prototype
193 A new prototype character has been added. C<_> is equivalent to C<$> (it
194 denotes a scalar), but defaults to C<$_> if the corresponding argument
195 isn't supplied. Due to the optional nature of the argument, you can only
196 use it at the end of a prototype, or before a semicolon.
198 This has a small incompatible consequence: the prototype() function has
199 been adjusted to return C<_> for some built-ins in appropriate cases (for
200 example, C<prototype('CORE::rmdir')>). (Rafael)
202 =head2 UNITCHECK blocks
204 C<UNITCHECK>, a new special code block has been introduced, in addition to
205 C<BEGIN>, C<CHECK>, C<INIT> and C<END>.
207 C<CHECK> and C<INIT> blocks, while useful for some specialized purposes,
208 are always executed at the transition between the compilation and the
209 execution of the main program, and thus are useless whenever code is
210 loaded at runtime. On the other hand, C<UNITCHECK> blocks are executed
211 just after the unit which defined them has been compiled. See L<perlmod>
212 for more information. (Alex Gough)
214 =head2 readpipe() is now overridable
216 The built-in function readpipe() is now overridable. Overriding it permits
217 also to override its operator counterpart, C<qx//> (a.k.a. C<``>).
218 Moreover, it now defaults to C<$_> if no argument is provided. (Rafael)
220 =head2 default argument for readline()
222 readline() now defaults to C<*ARGV> if no argument is provided. (Rafael)
226 The copy of the Unicode Character Database included in Perl 5.9 has
227 been updated to version 5.0.0.
231 The smart match operator (C<~~>) is now available by default (you don't
232 need to enable it with C<use feature> any longer). (Michael G Schwern)
234 =head2 Implicit loading of C<feature>
236 The C<feature> pragma is now implicitly loaded when you require a minimal
237 perl version (with the C<use VERSION> construct) greater than, or equal
240 =head1 Modules and Pragmas
242 =head2 New Pragma, C<mro>
244 A new pragma, C<mro> (for Method Resolution Order) has been added. It
245 permits to switch, on a per-class basis, the algorithm that perl uses to
246 find inherited methods in case of a multiple inheritance hierarchy. The
247 default MRO hasn't changed (DFS, for Depth First Search). Another MRO is
248 available: the C3 algorithm. See L<mro> for more information.
251 Note that, due to changes in the implementation of class hierarchy search,
252 code that used to undef the C<*ISA> glob will most probably break. Anyway,
253 undef'ing C<*ISA> had the side-effect of removing the magic on the @ISA
254 array and should not have been done in the first place.
256 =head2 bignum, bigint, bigrat
258 The three numeric pragmas C<bignum>, C<bigint> and C<bigrat> are now
259 lexically scoped. (Tels)
261 =head2 Math::BigInt/Math::BigFloat
263 Many bugs have been fixed; noteworthy are comparisons with NaN, which
264 no longer warn about undef values.
266 The following things are new:
272 The config() method now also supports the calling-style
273 C<< config('lib') >> in addition to C<< config()->{'lib'} >>.
277 Upon import, using C<< lib => 'Foo' >> now warns if the low-level library
278 cannot be found. To suppress the warning, you can use C<< try => 'Foo' >>
279 instead. To convert the warning into a die, use C<< only => 'Foo' >>
282 =item roundmode common
284 A rounding mode of C<common> is now supported.
288 Also, support for the following methods has been added:
292 =item bpi(), bcos(), bsin(), batan(), batan2()
298 =item from_hex(), from_oct(), and from_bin()
304 In addition, the default math-backend (Calc (Perl) and FastCalc (XS)) now
305 support storing numbers in parts with 9 digits instead of 7 on Perls with
306 either 64bit integer or long double support. This means math operations
307 scale better and are thus faster for really big numbers.
309 =head2 New Core Modules
315 C<Locale::Maketext::Simple>, needed by CPANPLUS, is a simple wrapper around
316 C<Locale::Maketext::Lexicon>. Note that C<Locale::Maketext::Lexicon> isn't
317 included in the perl core; the behaviour of C<Locale::Maketext::Simple>
318 gracefully degrades when the later isn't present.
322 C<Params::Check> implements a generic input parsing/checking mechanism. It
327 C<Term::UI> simplifies the task to ask questions at a terminal prompt.
331 C<Object::Accessor> provides an interface to create per-object accessors.
335 C<Module::Pluggable> is a simple framework to create modules that accept
336 pluggable sub-modules.
340 C<Module::Load::Conditional> provides simple ways to query and possibly
341 load installed modules.
345 C<Time::Piece> provides an object oriented interface to time functions,
346 overriding the built-ins localtime() and gmtime().
350 C<IPC::Cmd> helps to find and run external commands, possibly
355 C<File::Fetch> provide a simple generic file fetching mechanism.
359 C<Log::Message> and C<Log::Message::Simple> are used by the log facility
364 C<Archive::Extract> is a generic archive extraction mechanism
365 for F<.tar> (plain, gziped or bzipped) or F<.zip> files.
369 C<CPANPLUS> provides an API and a command-line tool to access the CPAN
374 =head2 Module changes
380 The C<assertions> pragma, its submodules C<assertions::activate> and
381 C<assertions::compat> and the B<-A> command-line switch have been removed.
382 The interface was not judged mature enough for inclusion in a stable
387 The C<base> pragma now warns if a class tries to inherit from itself.
390 =item C<strict> and C<warnings>
392 C<strict> and C<warnings> will now complain loudly if they are loaded via
393 incorrect casing (as in C<use Strict;>). (Johan Vromans)
397 The C<warnings> pragma doesn't load C<Carp> anymore. That means that code
398 that used C<Carp> routines without having loaded it at compile time might
399 need to be adjusted; typically, the following (faulty) code won't work
400 anymore, and will require parentheses to be added after the function name:
404 Carp::confess "argh";
408 C<less> now does something useful (or at least it tries to). In fact, it
409 has been turned into a lexical pragma. So, in your modules, you can now
410 test whether your users have requested to use less CPU, or less memory,
411 less magic, or maybe even less fat. See L<less> for more. (Joshua ben
414 =item C<Attribute::Handlers>
416 C<Attribute::Handlers> can now report the caller's file and line number.
421 C<B::Lint> is now based on C<Module::Pluggable>, and so can be extended
422 with plugins. (Joshua ben Jore)
426 It's now possible to access the lexical pragma hints (C<%^H>) by using the
427 method B::COP::hints_hash(). It returns a C<B::RHE> object, which in turn
428 can be used to get a hash reference via the method B::RHE::HASH(). (Joshua
431 =for p5p XXX document this in B.pm too
435 As the old 5005thread threading model has been removed, in favor of the
436 ithreads scheme, the C<Thread> module is now a compatibility wrapper, to
437 be used in old code only. It has been removed from the default list of
442 =head1 Utility Changes
446 C<cpanp>, the CPANPLUS shell, has been added. (C<cpanp-run-perl>, an
447 helper for CPANPLUS operation, has been added too, but isn't intended for
452 C<cpan2dist> is a new utility, that comes with CPANPLUS. It's a tool to
453 create distributions (or packages) from CPAN modules.
457 The output of C<pod2html> has been enhanced to be more customizable via
458 CSS. Some formatting problems were also corrected. (Jari Aalto)
462 =head2 New manpage, perlunifaq
464 A new manual page, L<perlunifaq> (the Perl Unicode FAQ), has been added
467 =head1 Performance Enhancements
469 =head1 Installation and Configuration Improvements
471 =head2 C++ compatibility
473 Efforts have been made to make perl and the core XS modules compilable
474 with various C++ compilers (although the situation is not perfect with
475 some of the compilers on some of the platforms tested.)
479 Perl now can be compiled with Microsoft Visual C++ 2005.
481 =head2 Static build on Win32
483 It's now possible to build a C<perl-static.exe> that doesn't depend
484 on C<perl59.dll> on Win32. See the Win32 makefiles for details.
489 All win32 builds (MS-Win, WinCE) have been merged and cleaned up.
491 =head2 C<d_pseudofork> and C<d_printf_format_null>
493 A new configuration variable, available as C<$Config{d_pseudofork}> in
494 the L<Config> module, has been added, to distinguish real fork() support
495 from fake pseudofork used on Windows platforms.
497 A new configuration variable, C<d_printf_format_null>, has been added,
498 to see if printf-like formats are allowed to be NULL.
502 C<Configure -h> has been extended with the most used option.
504 Much less 'Whoa there' messages.
508 Better detection of 64bit(only) systems, and setting all the (library)
513 Perl has been reported to work on MidnightBSD.
515 Support for Cray XT4 Catamount/Qk has been added.
517 Vendor patches have been merged for RedHat and GenToo.
519 =head1 Selected Bug Fixes
521 PerlIO::scalar will now prevent writing to read-only scalars. Moreover,
522 seek() is now supported with PerlIO::scalar-based filehandles, the
523 underlying string being zero-filled as needed. (Rafael, Jarkko Hietaniemi)
525 study() never worked for UTF-8 strings, but could lead to false results.
526 It's now a no-op on UTF-8 data. (Yves Orton)
528 The signals SIGILL, SIGBUS and SIGSEGV are now always delivered in an
529 "unsafe" manner (contrary to other signals, that are deferred until the
530 perl interpreter reaches a reasonably stable state; see
531 L<perlipc/"Deferred Signals (Safe Signals)">). (Rafael)
533 When a module or a file is loaded through an @INC-hook, and when this hook
534 has set a filename entry in %INC, __FILE__ is now set for this module
535 accordingly to the contents of that %INC entry. (Rafael)
537 The C<-w> and C<-t> switches can now be used together without messing
538 up what categories of warnings are activated or not. (Rafael)
540 Duping a filehandle which has the C<:utf8> PerlIO layer set will now
541 properly carry that layer on the duped filehandle. (Rafael)
543 Localizing an hash element whose key was given as a variable didn't work
544 correctly if the variable was changed while the local() was in effect (as
545 in C<local $h{$x}; ++$x>). (Bo Lindbergh)
547 =head1 New or Changed Diagnostics
551 Two deprecation warnings have been added: (Rafael)
553 Opening dirhandle %s also as a file
554 Opening filehandle %s also as a directory
556 =head1 Changed Internals
558 The anonymous hash and array constructors now take 1 op in the optree
559 instead of 3, now that pp_anonhash and pp_anonlist return a reference to
560 an hash/array when the op is flagged with OPf_SPECIAL (Nicholas Clark).
562 =for p5p XXX have we some docs on how to create regexp engine plugins, since that's now possible ? (perlreguts)
564 =for p5p XXX new BIND SV type, #29544, #29642
566 =head1 Known Problems
568 =head2 Platform Specific Problems
570 =head1 Reporting Bugs
572 If you find what you think is a bug, you might check the articles
573 recently posted to the comp.lang.perl.misc newsgroup and the perl
574 bug database at http://rt.perl.org/rt3/ . There may also be
575 information at http://www.perl.org/ , the Perl Home Page.
577 If you believe you have an unreported bug, please run the B<perlbug>
578 program included with your release. Be sure to trim your bug down
579 to a tiny but sufficient test case. Your bug report, along with the
580 output of C<perl -V>, will be sent off to perlbug@perl.org to be
581 analysed by the Perl porting team.
585 The F<Changes> file for exhaustive details on what changed.
587 The F<INSTALL> file for how to build Perl.
589 The F<README> file for general stuff.
591 The F<Artistic> and F<Copying> files for copyright information.