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