More perldelta entries from 5.9.3
[p5sagit/p5-mst-13.2.git] / pod / perl5100delta.pod
1 =head1 NAME
2
3 perldelta - what is new for perl 5.10.0
4
5 =head1 DESCRIPTION
6
7 This document describes the differences between the 5.8.8 release and
8 the 5.10.0 release.
9
10 Many of the bug fixes in 5.10.0 were already seen in the 5.8.X maintenance
11 releases; they are not duplicated here and are documented in the set of
12 man pages named perl58[1-8]?delta.
13
14 =head1 Incompatible Changes
15
16 =head2 Packing and UTF-8 strings
17
18 =for XXX update this
19
20 The semantics of pack() and unpack() regarding UTF-8-encoded data has been
21 changed. Processing is now by default character per character instead of
22 byte per byte on the underlying encoding. Notably, code that used things
23 like C<pack("a*", $string)> to see through the encoding of string will now
24 simply get back the original $string. Packed strings can also get upgraded
25 during processing when you store upgraded characters. You can get the old
26 behaviour by using C<use bytes>.
27
28 To be consistent with pack(), the C<C0> in unpack() templates indicates
29 that the data is to be processed in character mode, i.e. character by
30 character; on the contrary, C<U0> in unpack() indicates UTF-8 mode, where
31 the packed string is processed in its UTF-8-encoded Unicode form on a byte
32 by byte basis. This is reversed with regard to perl 5.8.X.
33
34 Moreover, C<C0> and C<U0> can also be used in pack() templates to specify
35 respectively character and byte modes.
36
37 C<C0> and C<U0> in the middle of a pack or unpack format now switch to the
38 specified encoding mode, honoring parens grouping. Previously, parens were
39 ignored.
40
41 Also, there is a new pack() character format, C<W>, which is intended to
42 replace the old C<C>. C<C> is kept for unsigned chars coded as bytes in
43 the strings internal representation. C<W> represents unsigned (logical)
44 character values, which can be greater than 255. It is therefore more
45 robust when dealing with potentially UTF-8-encoded data (as C<C> will wrap
46 values outside the range 0..255, and not respect the string encoding).
47
48 In practice, that means that pack formats are now encoding-neutral, except
49 C<C>.
50
51 For consistency, C<A> in unpack() format now trims all Unicode whitespace
52 from the end of the string. Before perl 5.9.2, it used to strip only the
53 classical ASCII space characters.
54
55 =head2 Byte/character count feature in unpack()
56
57 A new unpack() template character, C<".">, returns the number of bytes or
58 characters (depending on the selected encoding mode, see above) read so far.
59
60 =head2 The C<$*> and C<$#> variables have been removed
61
62 C<$*>, which was deprecated in favor of the C</s> and C</m> regexp
63 modifiers, has been removed.
64
65 The deprecated C<$#> variable (output format for numbers) has been
66 removed.
67
68 Two new warnings, C<$#/$* is no longer supported>, have been added.
69
70 =head2 substr() lvalues are no longer fixed-length
71
72 The lvalues returned by the three argument form of substr() used to be a
73 "fixed length window" on the original string. In some cases this could
74 cause surprising action at distance or other undefined behaviour. Now the
75 length of the window adjusts itself to the length of the string assigned to
76 it.
77
78 =head2 Parsing of C<-f _>
79
80 The identifier C<_> is now forced to be a bareword after a filetest
81 operator. This solves a number of misparsing issues when a global C<_>
82 subroutine is defined.
83
84 =head2 C<:unique>
85
86 The C<:unique> attribute has been made a no-op, since its current
87 implementation was fundamentally flawed and not threadsafe.
88
89 =head2 Scoping of the C<sort> pragma
90
91 The C<sort> pragma is now lexically scoped. Its effect used to be global.
92
93 =head2 Scoping of C<bignum>, C<bigint>, C<bigrat>
94
95 The three numeric pragmas C<bignum>, C<bigint> and C<bigrat> are now
96 lexically scoped. (Tels)
97
98 =head2 Effect of pragmas in eval
99
100 The compile-time value of the C<%^H> hint variable can now propagate into
101 eval("")uated code. This makes it more useful to implement lexical
102 pragmas.
103
104 As a side-effect of this, the overloaded-ness of constants now propagates
105 into eval("").
106
107 =head2 chdir FOO
108
109 A bareword argument to chdir() is now recognized as a file handle.
110 Earlier releases interpreted the bareword as a directory name.
111 (Gisle Aas)
112
113 =head2 Handling of .pmc files
114
115 An old feature of perl was that before C<require> or C<use> look for a
116 file with a F<.pm> extension, they will first look for a similar filename
117 with a F<.pmc> extension. If this file is found, it will be loaded in
118 place of any potentially existing file ending in a F<.pm> extension.
119
120 Previously, F<.pmc> files were loaded only if more recent than the
121 matching F<.pm> file. Starting with 5.9.4, they'll be always loaded if
122 they exist.
123
124 =head2 @- and @+ in patterns
125
126 The special arrays C<@-> and C<@+> are no longer interpolated in regular
127 expressions. (Sadahiro Tomoyuki)
128
129 =head2 $AUTOLOAD can now be tainted
130
131 If you call a subroutine by a tainted name, and if it defers to an
132 AUTOLOAD function, then $AUTOLOAD will be (correctly) tainted.
133 (Rick Delaney)
134
135 =head2 Tainting and printf
136
137 When perl is run under taint mode, C<printf()> and C<sprintf()> will now
138 reject any tainted format argument. (Rafael Garcia-Suarez)
139
140 =head2 undef and signal handlers
141
142 Undefining or deleting a signal handler via C<undef $SIG{FOO}> is now
143 equivalent to setting it to C<'DEFAULT'>. (Rafael Garcia-Suarez)
144
145 =head2 strictures and array/hash dereferencing in defined()
146
147 C<defined @$foo> and C<defined %$bar> are now subject to C<strict 'refs'>
148 (that is, C<$foo> and C<$bar> shall be proper references there.)
149 (Nicholas Clark)
150
151 (However, C<defined(@foo)> and C<defined(%bar)> are discouraged constructs
152 anyway.)
153
154 =head2 C<(?p{})> has been removed
155
156 The regular expression construct C<(?p{})>, which was deprecated in perl
157 5.8, has been removed. Use C<(??{})> instead. (Rafael Garcia-Suarez)
158
159 =head2 Pseudo-hashes have been removed
160
161 Support for pseudo-hashes has been removed from Perl 5.9. (The C<fields>
162 pragma remains here, but uses an alternate implementation.)
163
164 =head2 Removal of the bytecode compiler and of perlcc
165
166 C<perlcc>, the byteloader and the supporting modules (B::C, B::CC,
167 B::Bytecode, etc.) are no longer distributed with the perl sources. Those
168 experimental tools have never worked reliably, and, due to the lack of
169 volunteers to keep them in line with the perl interpreter developments, it
170 was decided to remove them instead of shipping a broken version of those.
171 The last version of those modules can be found with perl 5.9.4.
172
173 However the B compiler framework stays supported in the perl core, as with
174 the more useful modules it has permitted (among others, B::Deparse and
175 B::Concise).
176
177 =head2 Removal of the JPL
178
179 The JPL (Java-Perl Linguo) has been removed from the perl sources tarball.
180
181 =head2 Recursive inheritance detected earlier
182
183 Perl will now immediately throw an exception if you modify any package's
184 C<@ISA> in such a way that it would cause recursive inheritance.
185
186 Previously, the exception would not occur until Perl attempted to make
187 use of the recursive inheritance while resolving a method or doing a
188 C<$foo-E<gt>isa($bar)> lookup.
189
190 =head1 Core Enhancements
191
192 =head2 The C<feature> pragma
193
194 The C<feature> pragma is used to enable new syntax that would break Perl's
195 backwards-compatibility with older releases of the language. It's a lexical
196 pragma, like C<strict> or C<warnings>.
197
198 Currently the following new features are available: C<switch> (adds a
199 switch statement), C<say> (adds a C<say> built-in function), and C<state>
200 (adds an C<state> keyword for declaring "static" variables). Those
201 features are described in their own sections of this document.
202
203 The C<feature> pragma is also implicitly loaded when you require a minimal
204 perl version (with the C<use VERSION> construct) greater than, or equal
205 to, 5.9.5. See L<feature> for details.
206
207 =head2 New B<-E> command-line switch
208
209 B<-E> is equivalent to B<-e>, but it implicitly enables all
210 optional features (like C<use feature ":5.10">).
211
212 =head2 Defined-or operator
213
214 A new operator C<//> (defined-or) has been implemented.
215 The following statement:
216
217     $a // $b
218
219 is merely equivalent to
220
221    defined $a ? $a : $b
222
223 and
224
225    $c //= $d;
226
227 can now be used instead of
228
229    $c = $d unless defined $c;
230
231 The C<//> operator has the same precedence and associativity as C<||>.
232 Special care has been taken to ensure that this operator Do What You Mean
233 while not breaking old code, but some edge cases involving the empty
234 regular expression may now parse differently.  See L<perlop> for
235 details.
236
237 =head2 Switch and Smart Match operator
238
239 Perl 5 now has a switch statement. It's available when C<use feature
240 'switch'> is in effect. This feature introduces three new keywords,
241 C<given>, C<when>, and C<default>:
242
243     given ($foo) {
244         when (/^abc/) { $abc = 1; }
245         when (/^def/) { $def = 1; }
246         when (/^xyz/) { $xyz = 1; }
247         default { $nothing = 1; }
248     }
249
250 A more complete description of how Perl matches the switch variable
251 against the C<when> conditions is given in L<perlsyn/"Switch statements">.
252
253 This kind of match is called I<smart match>, and it's also possible to use
254 it outside of switch statements, via the new C<~~> operator. See
255 L<perlsyn/"Smart matching in detail">.
256
257 This feature was contributed by Robin Houston.
258
259 =head2 Regular expressions
260
261 =over 4
262
263 =item Recursive Patterns
264
265 It is now possible to write recursive patterns without using the C<(??{})>
266 construct. This new way is more efficient, and in many cases easier to
267 read.
268
269 Each capturing parenthesis can now be treated as an independent pattern
270 that can be entered by using the C<(?PARNO)> syntax (C<PARNO> standing for
271 "parenthesis number"). For example, the following pattern will match
272 nested balanced angle brackets:
273
274     /
275      ^                      # start of line
276      (                      # start capture buffer 1
277         <                   #   match an opening angle bracket
278         (?:                 #   match one of:
279             (?>             #     don't backtrack over the inside of this group
280                 [^<>]+      #       one or more non angle brackets
281             )               #     end non backtracking group
282         |                   #     ... or ...
283             (?1)            #     recurse to bracket 1 and try it again
284         )*                  #   0 or more times.
285         >                   #   match a closing angle bracket
286      )                      # end capture buffer one
287      $                      # end of line
288     /x
289
290 Note, users experienced with PCRE will find that the Perl implementation
291 of this feature differs from the PCRE one in that it is possible to
292 backtrack into a recursed pattern, whereas in PCRE the recursion is
293 atomic or "possessive" in nature. (Yves Orton)
294
295 =item Named Capture Buffers
296
297 It is now possible to name capturing parenthesis in a pattern and refer to
298 the captured contents by name. The naming syntax is C<< (?<NAME>....) >>.
299 It's possible to backreference to a named buffer with the C<< \k<NAME> >>
300 syntax. In code, the new magical hashes C<%+> and C<%-> can be used to
301 access the contents of the capture buffers.
302
303 Thus, to replace all doubled chars, one could write
304
305     s/(?<letter>.)\k<letter>/$+{letter}/g
306
307 Only buffers with defined contents will be "visible" in the C<%+> hash, so
308 it's possible to do something like
309
310     foreach my $name (keys %+) {
311         print "content of buffer '$name' is $+{$name}\n";
312     }
313
314 The C<%-> hash is a bit more complete, since it will contain array refs
315 holding values from all capture buffers similarly named, if there should
316 be many of them.
317
318 C<%+> and C<%-> are implemented as tied hashes through the new module
319 C<Tie::Hash::NamedCapture>.
320
321 Users exposed to the .NET regex engine will find that the perl
322 implementation differs in that the numerical ordering of the buffers
323 is sequential, and not "unnamed first, then named". Thus in the pattern
324
325    /(A)(?<B>B)(C)(?<D>D)/
326
327 $1 will be 'A', $2 will be 'B', $3 will be 'C' and $4 will be 'D' and not
328 $1 is 'A', $2 is 'C' and $3 is 'B' and $4 is 'D' that a .NET programmer
329 would expect. This is considered a feature. :-) (Yves Orton)
330
331 =item Possessive Quantifiers
332
333 Perl now supports the "possessive quantifier" syntax of the "atomic match"
334 pattern. Basically a possessive quantifier matches as much as it can and never
335 gives any back. Thus it can be used to control backtracking. The syntax is
336 similar to non-greedy matching, except instead of using a '?' as the modifier
337 the '+' is used. Thus C<?+>, C<*+>, C<++>, C<{min,max}+> are now legal
338 quantifiers. (Yves Orton)
339
340 =item Backtracking control verbs
341
342 The regex engine now supports a number of special-purpose backtrack
343 control verbs: (*THEN), (*PRUNE), (*MARK), (*SKIP), (*COMMIT), (*FAIL)
344 and (*ACCEPT). See L<perlre> for their descriptions. (Yves Orton)
345
346 =item Relative backreferences
347
348 A new syntax C<\g{N}> or C<\gN> where "N" is a decimal integer allows a
349 safer form of back-reference notation as well as allowing relative
350 backreferences. This should make it easier to generate and embed patterns
351 that contain backreferences. See L<perlre/"Capture buffers">. (Yves Orton)
352
353 =item C<\K> escape
354
355 The functionality of Jeff Pinyan's module Regexp::Keep has been added to
356 the core. You can now use in regular expressions the special escape C<\K>
357 as a way to do something like floating length positive lookbehind. It is
358 also useful in substitutions like:
359
360   s/(foo)bar/$1/g
361
362 that can now be converted to
363
364   s/foo\Kbar//g
365
366 which is much more efficient. (Yves Orton)
367
368 =item Vertical and horizontal whitespace, and linebreak
369
370 Regular expressions now recognize the C<\v> and C<\h> escapes, that match
371 vertical and horizontal whitespace, respectively. C<\V> and C<\H>
372 logically match their complements.
373
374 C<\R> matches a generic linebreak, that is, vertical whitespace, plus
375 the multi-character sequence C<"\x0D\x0A">.
376
377 =item Unicode Character Classes
378
379 Perl's regular expression engine now contains support for matching on the
380 intersection of two Unicode character classes. You can also now refer to
381 user-defined character classes from within other user defined character
382 classes.
383
384 =back
385
386 =head2 C<say()>
387
388 say() is a new built-in, only available when C<use feature 'say'> is in
389 effect, that is similar to print(), but that implicitly appends a newline
390 to the printed string. See L<perlfunc/say>. (Robin Houston)
391
392 =head2 Lexical C<$_>
393
394 The default variable C<$_> can now be lexicalized, by declaring it like
395 any other lexical variable, with a simple
396
397     my $_;
398
399 The operations that default on C<$_> will use the lexically-scoped
400 version of C<$_> when it exists, instead of the global C<$_>.
401
402 In a C<map> or a C<grep> block, if C<$_> was previously my'ed, then the
403 C<$_> inside the block is lexical as well (and scoped to the block).
404
405 In a scope where C<$_> has been lexicalized, you can still have access to
406 the global version of C<$_> by using C<$::_>, or, more simply, by
407 overriding the lexical declaration with C<our $_>.
408
409 =head2 The C<_> prototype
410
411 A new prototype character has been added. C<_> is equivalent to C<$> (it
412 denotes a scalar), but defaults to C<$_> if the corresponding argument
413 isn't supplied. Due to the optional nature of the argument, you can only
414 use it at the end of a prototype, or before a semicolon.
415
416 This has a small incompatible consequence: the prototype() function has
417 been adjusted to return C<_> for some built-ins in appropriate cases (for
418 example, C<prototype('CORE::rmdir')>). (Rafael Garcia-Suarez)
419
420 =head2 UNITCHECK blocks
421
422 C<UNITCHECK>, a new special code block has been introduced, in addition to
423 C<BEGIN>, C<CHECK>, C<INIT> and C<END>.
424
425 C<CHECK> and C<INIT> blocks, while useful for some specialized purposes,
426 are always executed at the transition between the compilation and the
427 execution of the main program, and thus are useless whenever code is
428 loaded at runtime. On the other hand, C<UNITCHECK> blocks are executed
429 just after the unit which defined them has been compiled. See L<perlmod>
430 for more information. (Alex Gough)
431
432 =head2 New Pragma, C<mro>
433
434 A new pragma, C<mro> (for Method Resolution Order) has been added. It
435 permits to switch, on a per-class basis, the algorithm that perl uses to
436 find inherited methods in case of a mutiple inheritance hierachy. The
437 default MRO hasn't changed (DFS, for Depth First Search). Another MRO is
438 available: the C3 algorithm. See L<mro> for more information.
439 (Brandon Black)
440
441 Note that, due to changes in the implentation of class hierarchy search,
442 code that used to undef the C<*ISA> glob will most probably break. Anyway,
443 undef'ing C<*ISA> had the side-effect of removing the magic on the @ISA
444 array and should not have been done in the first place.
445
446 =head2 readpipe() is now overridable
447
448 The built-in function readpipe() is now overridable. Overriding it permits
449 also to override its operator counterpart, C<qx//> (a.k.a. C<``>).
450 Moreover, it now defaults to C<$_> if no argument is provided. (Rafael
451 Garcia-Suarez)
452
453 =head2 default argument for readline()
454
455 readline() now defaults to C<*ARGV> if no argument is provided. (Rafael
456 Garcia-Suarez)
457
458 =head2 state() variables
459
460 A new class of variables has been introduced. State variables are similar
461 to C<my> variables, but are declared with the C<state> keyword in place of
462 C<my>. They're visible only in their lexical scope, but their value is
463 persistent: unlike C<my> variables, they're not undefined at scope entry,
464 but retain their previous value. (Rafael Garcia-Suarez, Nicholas Clark)
465
466 To use state variables, one needs to enable them by using
467
468     use feature "state";
469
470 or by using the C<-E> command-line switch in one-liners.
471 See L<perlsub/"Persistent variables via state()">.
472
473 =head2 Stacked filetest operators
474
475 As a new form of syntactic sugar, it's now possible to stack up filetest
476 operators. You can now write C<-f -w -x $file> in a row to mean
477 C<-x $file && -w _ && -f _>. See L<perlfunc/-X>.
478
479 =head2 UNIVERSAL::DOES()
480
481 The C<UNIVERSAL> class has a new method, C<DOES()>. It has been added to
482 solve semantic problems with the C<isa()> method. C<isa()> checks for
483 inheritance, while C<DOES()> has been designed to be overridden when
484 module authors use other types of relations between classes (in addition
485 to inheritance). (chromatic)
486
487 See L<< UNIVERSAL/"$obj->DOES( ROLE )" >>.
488
489 =head2 C<CLONE_SKIP()>
490
491 Perl has now support for the C<CLONE_SKIP> special subroutine. Like
492 C<CLONE>, C<CLONE_SKIP> is called once per package; however, it is called
493 just before cloning starts, and in the context of the parent thread. If it
494 returns a true value, then no objects of that class will be cloned. See
495 L<perlmod> for details. (Contributed by Dave Mitchell.)
496
497 =head2 Formats
498
499 Formats were improved in several ways. A new field, C<^*>, can be used for
500 variable-width, one-line-at-a-time text. Null characters are now handled
501 correctly in picture lines. Using C<@#> and C<~~> together will now
502 produce a compile-time error, as those format fields are incompatible.
503 L<perlform> has been improved, and miscellaneous bugs fixed.
504
505 =head2 Byte-order modifiers for pack() and unpack()
506
507 There are two new byte-order modifiers, C<E<gt>> (big-endian) and C<E<lt>>
508 (little-endian), that can be appended to most pack() and unpack() template
509 characters and groups to force a certain byte-order for that type or group.
510 See L<perlfunc/pack> and L<perlpacktut> for details.
511
512 =head2 C<no VERSION>
513
514 You can now use C<no> followed by a version number to specify that you
515 want to use a version of perl older than the specified one.
516
517 =head2 C<chdir>, C<chmod> and C<chown> on filehandles
518
519 C<chdir>, C<chmod> and C<chown> can now work on filehandles as well as
520 filenames, if the system supports respectively C<fchdir>, C<fchmod> and
521 C<fchown>, thanks to a patch provided by Gisle Aas.
522
523 =head2 OS groups
524
525 C<$(> and C<$)> now return groups in the order where the OS returns them,
526 thanks to Gisle Aas. This wasn't previously the case.
527
528 =head2 Recursive sort subs
529
530 You can now use recursive subroutines with sort(), thanks to Robin Houston.
531
532 =head2 Exceptions in constant folding
533
534 The constant folding routine is now wrapped in an exception handler, and
535 if folding throws an exception (such as attempting to evaluate 0/0), perl
536 now retains the current optree, rather than aborting the whole program.
537 (Nicholas Clark, Dave Mitchell)
538
539 =head2 Source filters in @INC
540
541 It's possible to enhance the mechanism of subroutine hooks in @INC by
542 adding a source filter on top of the filehandle opened and returned by the
543 hook. This feature was planned a long time ago, but wasn't quite working
544 until now. See L<perlfunc/require> for details. (Nicholas Clark)
545
546 =head2 New internal variables
547
548 =over 4
549
550 =item C<${^RE_DEBUG_FLAGS}>
551
552 This variable controls what debug flags are in effect for the regular
553 expression engine when running under C<use re "debug">. See L<re> for
554 details.
555
556 =item C<${^CHILD_ERROR_NATIVE}>
557
558 This variable gives the native status returned by the last pipe close,
559 backtick command, successful call to wait() or waitpid(), or from the
560 system() operator. See L<perlrun> for details. (Contributed by Gisle Aas.)
561
562 =back
563
564 =head2 Miscellaneous
565
566 C<unpack()> now defaults to unpacking the C<$_> variable.
567
568 C<mkdir()> without arguments now defaults to C<$_>.
569
570 The internal dump output has been improved, so that non-printable characters
571 such as newline and backspace are output in C<\x> notation, rather than
572 octal.
573
574 The B<-C> option can no longer be used on the C<#!> line. It wasn't
575 working there anyway.
576
577 =head2 PERLIO_DEBUG
578
579 The C<PERLIO_DEBUG> environment variable has no longer any effect for
580 setuid scripts and for scripts run with B<-T>.
581
582 Moreover, with a thread-enabled perl, using C<PERLIO_DEBUG> could lead to
583 an internal buffer overflow. This has been fixed.
584
585 =head2 UCD 5.0.0
586
587 The copy of the Unicode Character Database included in Perl 5 has
588 been updated to version 5.0.0.
589
590 =head2 MAD
591
592 MAD, which stands for I<Misc Attribute Decoration>, is a
593 still-in-development work leading to a Perl 5 to Perl 6 converter. To
594 enable it, it's necessary to pass the argument C<-Dmad> to Configure. The
595 obtained perl isn't binary compatible with a regular perl 5.9.4, and has
596 space and speed penalties; moreover not all regression tests still pass
597 with it. (Larry Wall, Nicholas Clark)
598
599 =head1 Modules and Pragmata
600
601 =head2 New modules
602
603 =over 4
604
605 =item *
606
607 C<encoding::warnings>, by Audrey Tang, is a module to emit warnings
608 whenever an ASCII character string containing high-bit bytes is implicitly
609 converted into UTF-8.
610
611 =item *
612
613 C<Module::CoreList>, by Richard Clamp, is a small handy module that tells
614 you what versions of core modules ship with any versions of Perl 5. It
615 comes with a command-line frontend, C<corelist>.
616
617 =item *
618
619 C<Math::BigInt::FastCalc> is an XS-enabled, and thus faster, version of
620 C<Math::BigInt::Calc>.
621
622 =item *
623
624 C<Compress::Zlib> is an interface to the zlib compression library. It
625 comes with a bundled version of zlib, so having a working zlib is not a
626 prerequisite to install it. It's used by C<Archive::Tar> (see below).
627
628 =item *
629
630 C<IO::Zlib> is an C<IO::>-style interface to C<Compress::Zlib>.
631
632 =item *
633
634 C<Archive::Tar> is a module to manipulate C<tar> archives.
635
636 =item *
637
638 C<Digest::SHA> is a module used to calculate many types of SHA digests,
639 has been included for SHA support in the CPAN module.
640
641 =item *
642
643 C<ExtUtils::CBuilder> and C<ExtUtils::ParseXS> have been added.
644
645 =back
646
647 =head1 Utility Changes
648
649 =over 4
650
651 =item perl -d
652
653 The Perl debugger can now save all debugger commands for sourcing later;
654 notably, it can now emulate stepping backwards, by restarting and
655 rerunning all bar the last command from a saved command history.
656
657 It can also display the parent inheritance tree of a given class, with the
658 C<i> command.
659
660 Perl has a new -dt command-line flag, which enables threads support in the
661 debugger.
662
663 =item ptar
664
665 C<ptar> is a pure perl implementation of C<tar>, that comes with
666 C<Archive::Tar>.
667
668 =item ptardiff
669
670 C<ptardiff> is a small script used to generate a diff between the contents
671 of a tar archive and a directory tree. Like C<ptar>, it comes with
672 C<Archive::Tar>.
673
674 =item shasum
675
676 C<shasum> is a command-line utility, used to print or to check SHA
677 digests. It comes with the new C<Digest::SHA> module.
678
679 =item corelist
680
681 The C<corelist> utility is now installed with perl (see L</"New modules">
682 above).
683
684 =item h2ph and h2xs
685
686 C<h2ph> and C<h2xs> have been made a bit more robust with regard to
687 "modern" C code.
688
689 C<h2xs> implements a new option C<--use-xsloader> to force use of
690 C<XSLoader> even in backwards compatible modules.
691
692 The handling of authors' names that had apostrophes has been fixed.
693
694 Any enums with negative values are now skipped.
695
696 =item perlivp
697
698 C<perlivp> no longer checks for F<*.ph> files by default.  Use the new C<-a>
699 option to run I<all> tests.
700
701 =item find2perl
702
703 C<find2perl> now assumes C<-print> as a default action. Previously, it
704 needed to be specified explicitly.
705
706 Several bugs have been fixed in C<find2perl>, regarding C<-exec> and
707 C<-eval>. Also the options C<-path>, C<-ipath> and C<-iname> have been
708 added.
709
710 =back
711
712 =head1 New Documentation
713
714 The new L<perlglossary> manpage is a glossary of terms used in the Perl
715 documentation, technical and otherwise, kindly provided by O'Reilly Media,
716 Inc.
717
718 The long-existing feature of C</(?{...})/> regexps setting C<$_> and pos()
719 is now documented.
720
721 =head1 Performance Enhancements
722
723 =over 4
724
725 =item In-place sorting
726
727 Sorting arrays in place (C<@a = sort @a>) is now optimized to avoid
728 making a temporary copy of the array.
729
730 Likewise, C<reverse sort ...> is now optimized to sort in reverse,
731 avoiding the generation of a temporary intermediate list.
732
733 =item Lexical array access
734
735 Access to elements of lexical arrays via a numeric constant between 0 and
736 255 is now faster. (This used to be only the case for global arrays.)
737
738 =item Trie optimization
739
740 The regexp engine now implements the trie optimization : it's able to
741 factorize common prefixes and suffixes in regular expressions. A new
742 special variable, ${^RE_TRIE_MAXBUF}, has been added to fine-tune this
743 optimization.
744
745 =item XS-assisted SWASHGET
746
747 Some pure-perl code that perl was using to retrieve Unicode properties and
748 transliteration mappings has been reimplemented in XS.
749
750 =item Constant subroutines
751
752 The interpreter internals now support a far more memory efficient form of
753 inlineable constants. Storing a reference to a constant value in a symbol
754 table is equivalent to a full typeglob referencing a constant subroutine,
755 but using about 400 bytes less memory. This proxy constant subroutine is
756 automatically upgraded to a real typeglob with subroutine if necessary.
757 The approach taken is analogous to the existing space optimisation for
758 subroutine stub declarations, which are stored as plain scalars in place
759 of the full typeglob.
760
761 Several of the core modules have been converted to use this feature for
762 their system dependent constants - as a result C<use POSIX;> now takes about
763 200K less memory.
764
765 =item C<PERL_DONT_CREATE_GVSV>
766
767 The new compilation flag C<PERL_DONT_CREATE_GVSV>, introduced as an option
768 in perl 5.8.8, is turned on by default in perl 5.9.3. It prevents perl
769 from creating an empty scalar with every new typeglob. See L<perl588delta>
770 for details.
771
772 =item Weak references are cheaper
773
774 Weak reference creation is now I<O(1)> rather than I<O(n)>, courtesy of
775 Nicholas Clark. Weak reference deletion remains I<O(n)>, but if deletion only
776 happens at program exit, it may be skipped completely.
777
778 =item sort() enhancements
779
780 Salvador FandiƱo provided improvements to reduce the memory usage of C<sort>
781 and to speed up some cases.
782
783 =back
784
785 =head1 Installation and Configuration Improvements
786
787 =head2 Compilation improvements
788
789 Run-time customization of @INC can be enabled by passing the
790 C<-Dusesitecustomize> flag to configure. When enabled, this will make perl
791 run F<$sitelibexp/sitecustomize.pl> before anything else.  This script can
792 then be set up to add additional entries to @INC.
793
794 There is alpha support for relocatable @INC entries.
795
796 Parallel makes should work properly now, although there may still be problems
797 if C<make test> is instructed to run in parallel.
798
799 Building with Borland's compilers on Win32 should work more smoothly. In
800 particular Steve Hay has worked to side step many warnings emitted by their
801 compilers and at least one C compiler internal error.
802
803 Perl extensions on Windows now can be statically built into the Perl DLL,
804 thanks to a work by Vadim Konovalov.
805
806 =head2 New Or Improved Platforms
807
808 Perl is being ported to Symbian OS. See L<perlsymbian> for more
809 information.
810
811 The VMS port has been improved. See L<perlvms>.
812
813 DynaLoader::dl_unload_file() now works on Windows.
814
815 Portability of Perl on various recent compilers on Windows has been
816 improved (Borland C++, Visual C++ 7.0).
817
818 =head2 Module auxiliary files
819
820 README files and changelogs for CPAN modules bundled with perl are no
821 longer installed.
822
823 =head1 Selected Bug Fixes
824
825 =over 4
826
827 =item strictures in regexp-eval blocks
828
829 C<strict> wasn't in effect in regexp-eval blocks (C</(?{...})/>).
830
831 =item C<defined $$x>
832
833 C<use strict "refs"> was ignoring taking a hard reference in an argument
834 to defined(), as in :
835
836     use strict "refs";
837     my $x = "foo";
838     if (defined $$x) {...}
839
840 This now correctly produces the run-time error C<Can't use string as a
841 SCALAR ref while "strict refs" in use>.
842
843 =item Calling CORE::require()
844
845 CORE::require() and CORE::do() were always parsed as require() and do()
846 when they were overridden. This is now fixed.
847
848 =item Subscripts of slices
849
850 You can now use a non-arrowed form for chained subscripts after a list
851 slice, like in:
852
853     ({foo => "bar"})[0]{foo}
854
855 This used to be a syntax error; a C<< -> >> was required.
856
857 =item C<no warnings 'category'> works correctly with -w
858
859 Previously when running with warnings enabled globally via C<-w>, selective
860 disabling of specific warning categories would actually turn off all warnings.
861 This is now fixed; now C<no warnings 'io';> will only turn off warnings in the
862 C<io> class. Previously it would erroneously turn off all warnings.
863
864 =item threads and memory usage
865
866 Several memory leaks in ithreads were closed. Also, ithreads were made
867 less memory-intensive.
868
869 =item chr() and negative values
870
871 chr() on a negative value now gives C<\x{FFFD}>, the Unicode replacement
872 character, unless when the C<bytes> pragma is in effect, where the low
873 eight bytes of the value are used.
874
875 =back
876
877 =head1 New or Changed Diagnostics
878
879 =over 4
880
881 =item Deprecated use of my() in false conditional
882
883 A new deprecation warning, I<Deprecated use of my() in false conditional>,
884 has been added, to warn against the use of the dubious and deprecated
885 construct
886
887     my $x if 0;
888
889 See L<perldiag>. Use C<state> variables instead.
890
891 =item !=~ should be !~
892
893 A new warning, C<!=~ should be !~>, is emitted to prevent this misspelling
894 of the non-matching operator.
895
896 =item Newline in left-justified string
897
898 The warning I<Newline in left-justified string> has been removed.
899
900 =item Too late for "-T" option
901
902 The error I<Too late for "-T" option> has been reformulated to be more
903 descriptive.
904
905 =item "%s" variable %s masks earlier declaration
906
907 This warning is now emitted in more consistent cases; in short, when one
908 of the declarations involved is a C<my> variable:
909
910     my $x;   my $x;     # warns
911     my $x;  our $x;     # warns
912     our $x;  my $x;     # warns
913
914 On the other hand, the following:
915
916     our $x; our $x;
917
918 now gives a C<"our" variable %s redeclared> warning.
919
920 =item readdir()/closedir()/etc. attempted on invalid dirhandle
921
922 These new warnings are now emitted when a dirhandle is used but is
923 either closed or not really a dirhandle.
924
925 =item perl -V
926
927 C<perl -V> has several improvements, making it more useable from shell
928 scripts to get the value of configuration variables. See L<perlrun> for
929 details.
930
931 =back
932
933 =head1 Changed Internals
934
935 In general, the source code of perl has been refactored, tied up, and
936 optimized in many places. Also, memory management and allocation has been
937 improved in a couple of points.
938
939 =head2 Reordering of SVt_* constants
940
941 The relative ordering of constants that define the various types of C<SV>
942 have changed; in particular, C<SVt_PVGV> has been moved before C<SVt_PVLV>,
943 C<SVt_PVAV>, C<SVt_PVHV> and C<SVt_PVCV>.  This is unlikely to make any
944 difference unless you have code that explicitly makes assumptions about that
945 ordering. (The inheritance hierarchy of C<B::*> objects has been changed
946 to reflect this.)
947
948 =head2 Removal of CPP symbols
949
950 The C preprocessor symbols C<PERL_PM_APIVERSION> and
951 C<PERL_XS_APIVERSION>, which were supposed to give the version number of
952 the oldest perl binary-compatible (resp. source-compatible) with the
953 present one, were not used, and sometimes had misleading values. They have
954 been removed.
955
956 =head2 Less space is used by ops
957
958 The C<BASEOP> structure now uses less space. The C<op_seq> field has been
959 removed and replaced by the one-bit fields C<op_opt>. C<op_type> is now 9
960 bits long. (Consequently, the C<B::OP> class doesn't provide an C<seq>
961 method anymore.)
962
963 =head2 New parser
964
965 perl's parser is now generated by bison (it used to be generated by
966 byacc.) As a result, it seems to be a bit more robust.
967
968 Also, Dave Mitchell improved the lexer debugging output under C<-DT>.
969
970 =head2 Use of C<const>
971
972 Andy Lester supplied many improvements to determine which function
973 parameters and local variables could actually be declared C<const> to the C
974 compiler. Steve Peters provided new C<*_set> macros and reworked the core to
975 use these rather than assigning to macros in LVALUE context.
976
977 =head2 Mathoms
978
979 A new file, F<mathoms.c>, has been added. It contains functions that are
980 no longer used in the perl core, but that remain available for binary or
981 source compatibility reasons. However, those functions will not be
982 compiled in if you add C<-DNO_MATHOMS> in the compiler flags.
983
984 =head2 C<AvFLAGS> has been removed
985
986 The C<AvFLAGS> macro has been removed.
987
988 =head2 C<av_*> changes
989
990 The C<av_*()> functions, used to manipulate arrays, no longer accept null
991 C<AV*> parameters.
992
993 =head2 B:: modules inheritance changed
994
995 The inheritance hierarchy of C<B::> modules has changed; C<B::NV> now
996 inherits from C<B::SV> (it used to inherit from C<B::IV>).
997
998 =head1 New Tests
999
1000 =head1 Known Problems
1001
1002 There's still a remaining problem in the implementation of the lexical
1003 C<$_>: it doesn't work inside C</(?{...})/> blocks. (See the TODO test in
1004 F<t/op/mydef.t>.)
1005
1006 =head1 Platform Specific Problems
1007
1008 =head1 Reporting Bugs
1009
1010 =head1 SEE ALSO
1011
1012 The F<Changes> file and the perl590delta to perl595delta man pages for
1013 exhaustive details on what changed.
1014
1015 The F<INSTALL> file for how to build Perl.
1016
1017 The F<README> file for general stuff.
1018
1019 The F<Artistic> and F<Copying> files for copyright information.
1020
1021 =cut