This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix #72850 - reading $! shouldn't SEGV if Strerror(errno) returns NULL.
[perl5.git] / pod / perl5100delta.pod
CommitLineData
81663c3a
RGS
1=encoding utf8
2
cf6c151c
RGS
3=head1 NAME
4
7120b314 5perl5100delta - what is new for perl 5.10.0
cf6c151c
RGS
6
7=head1 DESCRIPTION
8
9This document describes the differences between the 5.8.8 release and
10the 5.10.0 release.
11
12Many of the bug fixes in 5.10.0 were already seen in the 5.8.X maintenance
13releases; they are not duplicated here and are documented in the set of
14man pages named perl58[1-8]?delta.
15
cf6c151c
RGS
16=head1 Core Enhancements
17
18=head2 The C<feature> pragma
19
20The C<feature> pragma is used to enable new syntax that would break Perl's
21backwards-compatibility with older releases of the language. It's a lexical
22pragma, like C<strict> or C<warnings>.
23
24Currently the following new features are available: C<switch> (adds a
25switch statement), C<say> (adds a C<say> built-in function), and C<state>
292c2b28 26(adds a C<state> keyword for declaring "static" variables). Those
cf6c151c
RGS
27features are described in their own sections of this document.
28
29The C<feature> pragma is also implicitly loaded when you require a minimal
30perl version (with the C<use VERSION> construct) greater than, or equal
31to, 5.9.5. See L<feature> for details.
32
33=head2 New B<-E> command-line switch
34
35B<-E> is equivalent to B<-e>, but it implicitly enables all
36optional features (like C<use feature ":5.10">).
37
38=head2 Defined-or operator
39
40A new operator C<//> (defined-or) has been implemented.
dbef3c66 41The following expression:
cf6c151c
RGS
42
43 $a // $b
44
45is merely equivalent to
46
47 defined $a ? $a : $b
48
dbef3c66 49and the statement
cf6c151c
RGS
50
51 $c //= $d;
52
53can now be used instead of
54
55 $c = $d unless defined $c;
56
57The C<//> operator has the same precedence and associativity as C<||>.
58Special care has been taken to ensure that this operator Do What You Mean
59while not breaking old code, but some edge cases involving the empty
60regular expression may now parse differently. See L<perlop> for
61details.
62
63=head2 Switch and Smart Match operator
64
65Perl 5 now has a switch statement. It's available when C<use feature
66'switch'> is in effect. This feature introduces three new keywords,
67C<given>, C<when>, and C<default>:
68
69 given ($foo) {
70 when (/^abc/) { $abc = 1; }
71 when (/^def/) { $def = 1; }
72 when (/^xyz/) { $xyz = 1; }
73 default { $nothing = 1; }
74 }
75
76A more complete description of how Perl matches the switch variable
77against the C<when> conditions is given in L<perlsyn/"Switch statements">.
78
79This kind of match is called I<smart match>, and it's also possible to use
80it outside of switch statements, via the new C<~~> operator. See
81L<perlsyn/"Smart matching in detail">.
82
83This feature was contributed by Robin Houston.
84
85=head2 Regular expressions
86
87=over 4
88
89=item Recursive Patterns
90
91It is now possible to write recursive patterns without using the C<(??{})>
92construct. This new way is more efficient, and in many cases easier to
93read.
94
95Each capturing parenthesis can now be treated as an independent pattern
96that can be entered by using the C<(?PARNO)> syntax (C<PARNO> standing for
97"parenthesis number"). For example, the following pattern will match
98nested balanced angle brackets:
99
100 /
101 ^ # start of line
102 ( # start capture buffer 1
103 < # match an opening angle bracket
104 (?: # match one of:
105 (?> # don't backtrack over the inside of this group
d991eed6 106 [^<>]+ # one or more non angle brackets
cf6c151c
RGS
107 ) # end non backtracking group
108 | # ... or ...
109 (?1) # recurse to bracket 1 and try it again
110 )* # 0 or more times.
111 > # match a closing angle bracket
112 ) # end capture buffer one
113 $ # end of line
114 /x
115
e15dad31
JC
116PCRE users should note that Perl's recursive regex feature allows
117backtracking into a recursed pattern, whereas in PCRE the recursion is
118atomic or "possessive" in nature. As in the example above, you can
119add (?>) to control this selectively. (Yves Orton)
cf6c151c
RGS
120
121=item Named Capture Buffers
122
123It is now possible to name capturing parenthesis in a pattern and refer to
124the captured contents by name. The naming syntax is C<< (?<NAME>....) >>.
125It's possible to backreference to a named buffer with the C<< \k<NAME> >>
126syntax. In code, the new magical hashes C<%+> and C<%-> can be used to
127access the contents of the capture buffers.
128
e15dad31 129Thus, to replace all doubled chars with a single copy, one could write
cf6c151c
RGS
130
131 s/(?<letter>.)\k<letter>/$+{letter}/g
132
133Only buffers with defined contents will be "visible" in the C<%+> hash, so
134it's possible to do something like
135
136 foreach my $name (keys %+) {
137 print "content of buffer '$name' is $+{$name}\n";
138 }
139
140The C<%-> hash is a bit more complete, since it will contain array refs
141holding values from all capture buffers similarly named, if there should
142be many of them.
143
144C<%+> and C<%-> are implemented as tied hashes through the new module
145C<Tie::Hash::NamedCapture>.
146
147Users exposed to the .NET regex engine will find that the perl
148implementation differs in that the numerical ordering of the buffers
149is sequential, and not "unnamed first, then named". Thus in the pattern
150
151 /(A)(?<B>B)(C)(?<D>D)/
152
153$1 will be 'A', $2 will be 'B', $3 will be 'C' and $4 will be 'D' and not
154$1 is 'A', $2 is 'C' and $3 is 'B' and $4 is 'D' that a .NET programmer
155would expect. This is considered a feature. :-) (Yves Orton)
156
157=item Possessive Quantifiers
158
159Perl now supports the "possessive quantifier" syntax of the "atomic match"
160pattern. Basically a possessive quantifier matches as much as it can and never
161gives any back. Thus it can be used to control backtracking. The syntax is
162similar to non-greedy matching, except instead of using a '?' as the modifier
163the '+' is used. Thus C<?+>, C<*+>, C<++>, C<{min,max}+> are now legal
164quantifiers. (Yves Orton)
165
166=item Backtracking control verbs
167
168The regex engine now supports a number of special-purpose backtrack
169control verbs: (*THEN), (*PRUNE), (*MARK), (*SKIP), (*COMMIT), (*FAIL)
170and (*ACCEPT). See L<perlre> for their descriptions. (Yves Orton)
171
172=item Relative backreferences
173
174A new syntax C<\g{N}> or C<\gN> where "N" is a decimal integer allows a
175safer form of back-reference notation as well as allowing relative
176backreferences. This should make it easier to generate and embed patterns
177that contain backreferences. See L<perlre/"Capture buffers">. (Yves Orton)
178
179=item C<\K> escape
180
181The functionality of Jeff Pinyan's module Regexp::Keep has been added to
254a8700 182the core. In regular expressions you can now use the special escape C<\K>
cf6c151c
RGS
183as a way to do something like floating length positive lookbehind. It is
184also useful in substitutions like:
185
186 s/(foo)bar/$1/g
187
188that can now be converted to
189
190 s/foo\Kbar//g
191
192which is much more efficient. (Yves Orton)
193
194=item Vertical and horizontal whitespace, and linebreak
195
292c2b28 196Regular expressions now recognize the C<\v> and C<\h> escapes that match
cf6c151c
RGS
197vertical and horizontal whitespace, respectively. C<\V> and C<\H>
198logically match their complements.
199
200C<\R> matches a generic linebreak, that is, vertical whitespace, plus
201the multi-character sequence C<"\x0D\x0A">.
202
203=back
204
205=head2 C<say()>
206
207say() is a new built-in, only available when C<use feature 'say'> is in
208effect, that is similar to print(), but that implicitly appends a newline
209to the printed string. See L<perlfunc/say>. (Robin Houston)
210
211=head2 Lexical C<$_>
212
213The default variable C<$_> can now be lexicalized, by declaring it like
214any other lexical variable, with a simple
215
216 my $_;
217
218The operations that default on C<$_> will use the lexically-scoped
219version of C<$_> when it exists, instead of the global C<$_>.
220
221In a C<map> or a C<grep> block, if C<$_> was previously my'ed, then the
222C<$_> inside the block is lexical as well (and scoped to the block).
223
224In a scope where C<$_> has been lexicalized, you can still have access to
225the global version of C<$_> by using C<$::_>, or, more simply, by
597bb945 226overriding the lexical declaration with C<our $_>. (Rafael Garcia-Suarez)
cf6c151c
RGS
227
228=head2 The C<_> prototype
229
254a8700 230A new prototype character has been added. C<_> is equivalent to C<$> but
62ba2c93
RB
231defaults to C<$_> if the corresponding argument isn't supplied (both C<$>
232and C<_> denote a scalar). Due to the optional nature of the argument,
233you can only use it at the end of a prototype, or before a semicolon.
cf6c151c
RGS
234
235This has a small incompatible consequence: the prototype() function has
236been adjusted to return C<_> for some built-ins in appropriate cases (for
237example, C<prototype('CORE::rmdir')>). (Rafael Garcia-Suarez)
238
239=head2 UNITCHECK blocks
240
241C<UNITCHECK>, a new special code block has been introduced, in addition to
242C<BEGIN>, C<CHECK>, C<INIT> and C<END>.
243
244C<CHECK> and C<INIT> blocks, while useful for some specialized purposes,
245are always executed at the transition between the compilation and the
246execution of the main program, and thus are useless whenever code is
247loaded at runtime. On the other hand, C<UNITCHECK> blocks are executed
248just after the unit which defined them has been compiled. See L<perlmod>
249for more information. (Alex Gough)
250
251=head2 New Pragma, C<mro>
252
253A new pragma, C<mro> (for Method Resolution Order) has been added. It
254permits to switch, on a per-class basis, the algorithm that perl uses to
dbef3c66 255find inherited methods in case of a multiple inheritance hierarchy. The
cf6c151c
RGS
256default MRO hasn't changed (DFS, for Depth First Search). Another MRO is
257available: the C3 algorithm. See L<mro> for more information.
258(Brandon Black)
259
dbef3c66 260Note that, due to changes in the implementation of class hierarchy search,
cf6c151c
RGS
261code that used to undef the C<*ISA> glob will most probably break. Anyway,
262undef'ing C<*ISA> had the side-effect of removing the magic on the @ISA
0e44e2ed
RGS
263array and should not have been done in the first place. Also, the
264cache C<*::ISA::CACHE::> no longer exists; to force reset the @ISA cache,
265you now need to use the C<mro> API, or more simply to assign to @ISA
266(e.g. with C<@ISA = @ISA>).
cf6c151c 267
3de67921
JD
268=head2 readdir() may return a "short filename" on Windows
269
270The readdir() function may return a "short filename" when the long
271filename contains characters outside the ANSI codepage. Similarly
272Cwd::cwd() may return a short directory name, and glob() may return short
273names as well. On the NTFS file system these short names can always be
274represented in the ANSI codepage. This will not be true for all other file
275system drivers; e.g. the FAT filesystem stores short filenames in the OEM
276codepage, so some files on FAT volumes remain unaccessible through the
277ANSI APIs.
278
279Similarly, $^X, @INC, and $ENV{PATH} are preprocessed at startup to make
280sure all paths are valid in the ANSI codepage (if possible).
281
282The Win32::GetLongPathName() function now returns the UTF-8 encoded
283correct long file name instead of using replacement characters to force
284the name into the ANSI codepage. The new Win32::GetANSIPathName()
285function can be used to turn a long pathname into a short one only if the
286long one cannot be represented in the ANSI codepage.
287
288Many other functions in the C<Win32> module have been improved to accept
289UTF-8 encoded arguments. Please see L<Win32> for details.
290
cf6c151c
RGS
291=head2 readpipe() is now overridable
292
293The built-in function readpipe() is now overridable. Overriding it permits
294also to override its operator counterpart, C<qx//> (a.k.a. C<``>).
295Moreover, it now defaults to C<$_> if no argument is provided. (Rafael
296Garcia-Suarez)
297
597bb945 298=head2 Default argument for readline()
cf6c151c
RGS
299
300readline() now defaults to C<*ARGV> if no argument is provided. (Rafael
301Garcia-Suarez)
302
303=head2 state() variables
304
305A new class of variables has been introduced. State variables are similar
306to C<my> variables, but are declared with the C<state> keyword in place of
307C<my>. They're visible only in their lexical scope, but their value is
308persistent: unlike C<my> variables, they're not undefined at scope entry,
309but retain their previous value. (Rafael Garcia-Suarez, Nicholas Clark)
310
311To use state variables, one needs to enable them by using
312
254a8700 313 use feature 'state';
cf6c151c
RGS
314
315or by using the C<-E> command-line switch in one-liners.
d991eed6 316See L<perlsub/"Persistent Private Variables">.
cf6c151c
RGS
317
318=head2 Stacked filetest operators
319
320As a new form of syntactic sugar, it's now possible to stack up filetest
321operators. You can now write C<-f -w -x $file> in a row to mean
322C<-x $file && -w _ && -f _>. See L<perlfunc/-X>.
323
324=head2 UNIVERSAL::DOES()
325
326The C<UNIVERSAL> class has a new method, C<DOES()>. It has been added to
327solve semantic problems with the C<isa()> method. C<isa()> checks for
328inheritance, while C<DOES()> has been designed to be overridden when
329module authors use other types of relations between classes (in addition
330to inheritance). (chromatic)
331
332See L<< UNIVERSAL/"$obj->DOES( ROLE )" >>.
333
cf6c151c
RGS
334=head2 Formats
335
336Formats were improved in several ways. A new field, C<^*>, can be used for
337variable-width, one-line-at-a-time text. Null characters are now handled
338correctly in picture lines. Using C<@#> and C<~~> together will now
339produce a compile-time error, as those format fields are incompatible.
340L<perlform> has been improved, and miscellaneous bugs fixed.
341
342=head2 Byte-order modifiers for pack() and unpack()
343
344There are two new byte-order modifiers, C<E<gt>> (big-endian) and C<E<lt>>
345(little-endian), that can be appended to most pack() and unpack() template
346characters and groups to force a certain byte-order for that type or group.
347See L<perlfunc/pack> and L<perlpacktut> for details.
348
cf6c151c
RGS
349=head2 C<no VERSION>
350
351You can now use C<no> followed by a version number to specify that you
352want to use a version of perl older than the specified one.
353
354=head2 C<chdir>, C<chmod> and C<chown> on filehandles
355
356C<chdir>, C<chmod> and C<chown> can now work on filehandles as well as
357filenames, if the system supports respectively C<fchdir>, C<fchmod> and
358C<fchown>, thanks to a patch provided by Gisle Aas.
359
360=head2 OS groups
361
362C<$(> and C<$)> now return groups in the order where the OS returns them,
363thanks to Gisle Aas. This wasn't previously the case.
364
365=head2 Recursive sort subs
366
367You can now use recursive subroutines with sort(), thanks to Robin Houston.
368
369=head2 Exceptions in constant folding
370
371The constant folding routine is now wrapped in an exception handler, and
372if folding throws an exception (such as attempting to evaluate 0/0), perl
373now retains the current optree, rather than aborting the whole program.
254a8700
NC
374Without this change, programs would not compile if they had expressions that
375happened to generate exceptions, even though those expressions were in code
376that could never be reached at runtime. (Nicholas Clark, Dave Mitchell)
cf6c151c
RGS
377
378=head2 Source filters in @INC
379
380It's possible to enhance the mechanism of subroutine hooks in @INC by
381adding a source filter on top of the filehandle opened and returned by the
382hook. This feature was planned a long time ago, but wasn't quite working
383until now. See L<perlfunc/require> for details. (Nicholas Clark)
384
385=head2 New internal variables
386
387=over 4
388
389=item C<${^RE_DEBUG_FLAGS}>
390
391This variable controls what debug flags are in effect for the regular
392expression engine when running under C<use re "debug">. See L<re> for
393details.
394
395=item C<${^CHILD_ERROR_NATIVE}>
396
397This variable gives the native status returned by the last pipe close,
398backtick command, successful call to wait() or waitpid(), or from the
eaade56e 399system() operator. See L<perlvar> for details. (Contributed by Gisle Aas.)
cf6c151c 400
597bb945
RGS
401=item C<${^RE_TRIE_MAXBUF}>
402
403See L</"Trie optimisation of literal string alternations">.
404
405=item C<${^WIN32_SLOPPY_STAT}>
406
407See L</"Sloppy stat on Windows">.
408
cf6c151c
RGS
409=back
410
411=head2 Miscellaneous
412
413C<unpack()> now defaults to unpacking the C<$_> variable.
414
415C<mkdir()> without arguments now defaults to C<$_>.
416
417The internal dump output has been improved, so that non-printable characters
418such as newline and backspace are output in C<\x> notation, rather than
419octal.
420
421The B<-C> option can no longer be used on the C<#!> line. It wasn't
cba8bf60
RGS
422working there anyway, since the standard streams are already set up
423at this point in the execution of the perl interpreter. You can use
424binmode() instead to get the desired behaviour.
cf6c151c
RGS
425
426=head2 UCD 5.0.0
427
428The copy of the Unicode Character Database included in Perl 5 has
429been updated to version 5.0.0.
430
cf6c151c
RGS
431=head2 MAD
432
254a8700 433MAD, which stands for I<Miscellaneous Attribute Decoration>, is a
cf6c151c
RGS
434still-in-development work leading to a Perl 5 to Perl 6 converter. To
435enable it, it's necessary to pass the argument C<-Dmad> to Configure. The
254a8700 436obtained perl isn't binary compatible with a regular perl 5.10, and has
cf6c151c
RGS
437space and speed penalties; moreover not all regression tests still pass
438with it. (Larry Wall, Nicholas Clark)
439
c7d332a5
RGS
440=head2 kill() on Windows
441
442On Windows platforms, C<kill(-9, $pid)> now kills a process tree.
e1020413 443(On Unix, this delivers the signal to all processes in the same process
c7d332a5
RGS
444group.)
445
597bb945
RGS
446=head1 Incompatible Changes
447
448=head2 Packing and UTF-8 strings
449
597bb945
RGS
450The semantics of pack() and unpack() regarding UTF-8-encoded data has been
451changed. Processing is now by default character per character instead of
452byte per byte on the underlying encoding. Notably, code that used things
453like C<pack("a*", $string)> to see through the encoding of string will now
454simply get back the original $string. Packed strings can also get upgraded
455during processing when you store upgraded characters. You can get the old
456behaviour by using C<use bytes>.
457
458To be consistent with pack(), the C<C0> in unpack() templates indicates
459that the data is to be processed in character mode, i.e. character by
460character; on the contrary, C<U0> in unpack() indicates UTF-8 mode, where
461the packed string is processed in its UTF-8-encoded Unicode form on a byte
254a8700
NC
462by byte basis. This is reversed with regard to perl 5.8.X, but now consistent
463between pack() and unpack().
597bb945
RGS
464
465Moreover, C<C0> and C<U0> can also be used in pack() templates to specify
466respectively character and byte modes.
467
468C<C0> and C<U0> in the middle of a pack or unpack format now switch to the
469specified encoding mode, honoring parens grouping. Previously, parens were
470ignored.
471
472Also, there is a new pack() character format, C<W>, which is intended to
473replace the old C<C>. C<C> is kept for unsigned chars coded as bytes in
474the strings internal representation. C<W> represents unsigned (logical)
475character values, which can be greater than 255. It is therefore more
476robust when dealing with potentially UTF-8-encoded data (as C<C> will wrap
477values outside the range 0..255, and not respect the string encoding).
478
479In practice, that means that pack formats are now encoding-neutral, except
480C<C>.
481
482For consistency, C<A> in unpack() format now trims all Unicode whitespace
483from the end of the string. Before perl 5.9.2, it used to strip only the
484classical ASCII space characters.
485
486=head2 Byte/character count feature in unpack()
487
488A new unpack() template character, C<".">, returns the number of bytes or
489characters (depending on the selected encoding mode, see above) read so far.
490
491=head2 The C<$*> and C<$#> variables have been removed
492
493C<$*>, which was deprecated in favor of the C</s> and C</m> regexp
494modifiers, has been removed.
495
496The deprecated C<$#> variable (output format for numbers) has been
497removed.
498
f00638a2 499Two new severe warnings, C<$#/$* is no longer supported>, have been added.
597bb945
RGS
500
501=head2 substr() lvalues are no longer fixed-length
502
503The lvalues returned by the three argument form of substr() used to be a
504"fixed length window" on the original string. In some cases this could
505cause surprising action at distance or other undefined behaviour. Now the
506length of the window adjusts itself to the length of the string assigned to
507it.
508
509=head2 Parsing of C<-f _>
510
511The identifier C<_> is now forced to be a bareword after a filetest
512operator. This solves a number of misparsing issues when a global C<_>
513subroutine is defined.
514
515=head2 C<:unique>
516
517The C<:unique> attribute has been made a no-op, since its current
518implementation was fundamentally flawed and not threadsafe.
519
597bb945
RGS
520=head2 Effect of pragmas in eval
521
522The compile-time value of the C<%^H> hint variable can now propagate into
523eval("")uated code. This makes it more useful to implement lexical
524pragmas.
525
526As a side-effect of this, the overloaded-ness of constants now propagates
527into eval("").
528
529=head2 chdir FOO
530
531A bareword argument to chdir() is now recognized as a file handle.
532Earlier releases interpreted the bareword as a directory name.
533(Gisle Aas)
534
535=head2 Handling of .pmc files
536
537An old feature of perl was that before C<require> or C<use> look for a
538file with a F<.pm> extension, they will first look for a similar filename
539with a F<.pmc> extension. If this file is found, it will be loaded in
540place of any potentially existing file ending in a F<.pm> extension.
541
542Previously, F<.pmc> files were loaded only if more recent than the
543matching F<.pm> file. Starting with 5.9.4, they'll be always loaded if
544they exist.
545
a32521b7
JD
546=head2 $^V is now a C<version> object instead of a v-string
547
548$^V can still be used with the C<%vd> format in printf, but any
549character-level operations will now access the string representation
550of the C<version> object and not the ordinals of a v-string.
551Expressions like C<< substr($^V, 0, 2) >> or C<< split //, $^V >>
552no longer work and must be rewritten.
553
597bb945
RGS
554=head2 @- and @+ in patterns
555
556The special arrays C<@-> and C<@+> are no longer interpolated in regular
557expressions. (Sadahiro Tomoyuki)
558
559=head2 $AUTOLOAD can now be tainted
560
561If you call a subroutine by a tainted name, and if it defers to an
562AUTOLOAD function, then $AUTOLOAD will be (correctly) tainted.
563(Rick Delaney)
564
565=head2 Tainting and printf
566
567When perl is run under taint mode, C<printf()> and C<sprintf()> will now
568reject any tainted format argument. (Rafael Garcia-Suarez)
569
570=head2 undef and signal handlers
571
572Undefining or deleting a signal handler via C<undef $SIG{FOO}> is now
573equivalent to setting it to C<'DEFAULT'>. (Rafael Garcia-Suarez)
574
575=head2 strictures and dereferencing in defined()
576
254a8700 577C<use strict 'refs'> was ignoring taking a hard reference in an argument
597bb945
RGS
578to defined(), as in :
579
254a8700
NC
580 use strict 'refs';
581 my $x = 'foo';
597bb945
RGS
582 if (defined $$x) {...}
583
584This now correctly produces the run-time error C<Can't use string as a
585SCALAR ref while "strict refs" in use>.
586
587C<defined @$foo> and C<defined %$bar> are now also subject to C<strict
588'refs'> (that is, C<$foo> and C<$bar> shall be proper references there.)
589(C<defined(@foo)> and C<defined(%bar)> are discouraged constructs anyway.)
590(Nicholas Clark)
591
592=head2 C<(?p{})> has been removed
593
594The regular expression construct C<(?p{})>, which was deprecated in perl
5955.8, has been removed. Use C<(??{})> instead. (Rafael Garcia-Suarez)
596
597=head2 Pseudo-hashes have been removed
598
599Support for pseudo-hashes has been removed from Perl 5.9. (The C<fields>
600pragma remains here, but uses an alternate implementation.)
601
602=head2 Removal of the bytecode compiler and of perlcc
603
604C<perlcc>, the byteloader and the supporting modules (B::C, B::CC,
605B::Bytecode, etc.) are no longer distributed with the perl sources. Those
606experimental tools have never worked reliably, and, due to the lack of
607volunteers to keep them in line with the perl interpreter developments, it
608was decided to remove them instead of shipping a broken version of those.
609The last version of those modules can be found with perl 5.9.4.
610
611However the B compiler framework stays supported in the perl core, as with
612the more useful modules it has permitted (among others, B::Deparse and
613B::Concise).
614
615=head2 Removal of the JPL
616
ed8ea1b6 617The JPL (Java-Perl Lingo) has been removed from the perl sources tarball.
597bb945
RGS
618
619=head2 Recursive inheritance detected earlier
620
621Perl will now immediately throw an exception if you modify any package's
622C<@ISA> in such a way that it would cause recursive inheritance.
623
624Previously, the exception would not occur until Perl attempted to make
625use of the recursive inheritance while resolving a method or doing a
626C<$foo-E<gt>isa($bar)> lookup.
627
d99e543b
JV
628=head2 warnings::register changed to favor users of modules
629
630The behaviour in 5.10.x favors the person using the module;
631The behaviour in 5.8.x favors the module writer;
632
633Assume the following code:
634
635 main calls Foo::Bar::baz()
636 Foo::Bar inherits from Foo::Base
637 Foo::Bar::baz() calls Foo::Base::_bazbaz()
638 Foo::Base::_bazbaz() calls: warnings::warnif('substr', 'some warning
639message');
640
641On 5.8.x, the code warns when Foo::Bar contains C<use warnings;>
642It does not matter if Foo::Base or main have warnings enabled
643to disable the warning one has to modify Foo::Bar.
644
645On 5.10.0 and newer, the code warns when main contains C<use warnings;>
646It does not matter if Foo::Base or Foo::Bar have warnings enabled
647to disable the warning one has to modify main.
648
cf6c151c 649=head1 Modules and Pragmata
c0c97549 650
187a0176
AD
651=head2 Upgrading individual core modules
652
653Even more core modules are now also available separately through the
654CPAN. If you wish to update one of these modules, you don't need to
655wait for a new perl release. From within the cpan shell, running the
656'r' command will report on modules with upgrades available. See
657C<perldoc CPAN> for more information.
658
f0e260b8
RGS
659=head2 Pragmata Changes
660
661=over 4
662
663=item C<feature>
664
665The new pragma C<feature> is used to enable new features that might break
666old code. See L</"The C<feature> pragma"> above.
667
668=item C<mro>
669
670This new pragma enables to change the algorithm used to resolve inherited
671methods. See L</"New Pragma, C<mro>"> above.
672
673=item Scoping of the C<sort> pragma
674
675The C<sort> pragma is now lexically scoped. Its effect used to be global.
676
677=item Scoping of C<bignum>, C<bigint>, C<bigrat>
678
679The three numeric pragmas C<bignum>, C<bigint> and C<bigrat> are now
680lexically scoped. (Tels)
681
682=item C<base>
683
684The C<base> pragma now warns if a class tries to inherit from itself.
685(Curtis "Ovid" Poe)
686
687=item C<strict> and C<warnings>
688
689C<strict> and C<warnings> will now complain loudly if they are loaded via
690incorrect casing (as in C<use Strict;>). (Johan Vromans)
691
6601a838
RGS
692=item C<version>
693
694The C<version> module provides support for version objects.
695
f0e260b8
RGS
696=item C<warnings>
697
698The C<warnings> pragma doesn't load C<Carp> anymore. That means that code
699that used C<Carp> routines without having loaded it at compile time might
700need to be adjusted; typically, the following (faulty) code won't work
701anymore, and will require parentheses to be added after the function name:
702
703 use warnings;
704 require Carp;
254a8700 705 Carp::confess 'argh';
f0e260b8
RGS
706
707=item C<less>
708
709C<less> now does something useful (or at least it tries to). In fact, it
710has been turned into a lexical pragma. So, in your modules, you can now
711test whether your users have requested to use less CPU, or less memory,
712less magic, or maybe even less fat. See L<less> for more. (Joshua ben
713Jore)
714
715=back
716
0eece9c0
RGS
717=head2 New modules
718
719=over 4
720
721=item *
722
723C<encoding::warnings>, by Audrey Tang, is a module to emit warnings
724whenever an ASCII character string containing high-bit bytes is implicitly
597bb945
RGS
725converted into UTF-8. It's a lexical pragma since Perl 5.9.4; on older
726perls, its effect is global.
0eece9c0
RGS
727
728=item *
729
730C<Module::CoreList>, by Richard Clamp, is a small handy module that tells
731you what versions of core modules ship with any versions of Perl 5. It
732comes with a command-line frontend, C<corelist>.
733
bd3831ee
RGS
734=item *
735
736C<Math::BigInt::FastCalc> is an XS-enabled, and thus faster, version of
737C<Math::BigInt::Calc>.
738
739=item *
740
741C<Compress::Zlib> is an interface to the zlib compression library. It
742comes with a bundled version of zlib, so having a working zlib is not a
743prerequisite to install it. It's used by C<Archive::Tar> (see below).
744
745=item *
746
747C<IO::Zlib> is an C<IO::>-style interface to C<Compress::Zlib>.
748
749=item *
750
751C<Archive::Tar> is a module to manipulate C<tar> archives.
752
753=item *
754
755C<Digest::SHA> is a module used to calculate many types of SHA digests,
756has been included for SHA support in the CPAN module.
757
758=item *
759
760C<ExtUtils::CBuilder> and C<ExtUtils::ParseXS> have been added.
761
597bb945
RGS
762=item *
763
764C<Hash::Util::FieldHash>, by Anno Siegel, has been added. This module
765provides support for I<field hashes>: hashes that maintain an association
766of a reference with a value, in a thread-safe garbage-collected way.
767Such hashes are useful to implement inside-out objects.
768
769=item *
770
771C<Module::Build>, by Ken Williams, has been added. It's an alternative to
772C<ExtUtils::MakeMaker> to build and install perl modules.
773
774=item *
775
776C<Module::Load>, by Jos Boumans, has been added. It provides a single
777interface to load Perl modules and F<.pl> files.
778
779=item *
780
781C<Module::Loaded>, by Jos Boumans, has been added. It's used to mark
782modules as loaded or unloaded.
783
784=item *
785
786C<Package::Constants>, by Jos Boumans, has been added. It's a simple
787helper to list all constants declared in a given package.
788
789=item *
790
791C<Win32API::File>, by Tye McQueen, has been added (for Windows builds).
792This module provides low-level access to Win32 system API calls for
793files/dirs.
794
f0e260b8
RGS
795=item *
796
797C<Locale::Maketext::Simple>, needed by CPANPLUS, is a simple wrapper around
798C<Locale::Maketext::Lexicon>. Note that C<Locale::Maketext::Lexicon> isn't
799included in the perl core; the behaviour of C<Locale::Maketext::Simple>
800gracefully degrades when the later isn't present.
801
802=item *
803
804C<Params::Check> implements a generic input parsing/checking mechanism. It
805is used by CPANPLUS.
806
807=item *
808
809C<Term::UI> simplifies the task to ask questions at a terminal prompt.
810
811=item *
812
813C<Object::Accessor> provides an interface to create per-object accessors.
814
815=item *
816
817C<Module::Pluggable> is a simple framework to create modules that accept
818pluggable sub-modules.
819
820=item *
821
822C<Module::Load::Conditional> provides simple ways to query and possibly
823load installed modules.
824
825=item *
826
827C<Time::Piece> provides an object oriented interface to time functions,
828overriding the built-ins localtime() and gmtime().
829
830=item *
831
832C<IPC::Cmd> helps to find and run external commands, possibly
833interactively.
834
835=item *
836
837C<File::Fetch> provide a simple generic file fetching mechanism.
838
839=item *
840
841C<Log::Message> and C<Log::Message::Simple> are used by the log facility
842of C<CPANPLUS>.
843
844=item *
845
846C<Archive::Extract> is a generic archive extraction mechanism
847for F<.tar> (plain, gziped or bzipped) or F<.zip> files.
848
849=item *
850
851C<CPANPLUS> provides an API and a command-line tool to access the CPAN
852mirrors.
853
e6746346
SP
854=item *
855
856C<Pod::Escapes> provides utilities that are useful in decoding Pod
857EE<lt>...E<gt> sequences.
858
859=item *
860
861C<Pod::Simple> is now the backend for several of the Pod-related modules
862included with Perl.
863
f0e260b8
RGS
864=back
865
866=head2 Selected Changes to Core Modules
867
868=over 4
869
870=item C<Attribute::Handlers>
871
872C<Attribute::Handlers> can now report the caller's file and line number.
873(David Feldman)
874
6cdf4617
RGS
875All interpreted attributes are now passed as array references. (Damian
876Conway)
877
f0e260b8
RGS
878=item C<B::Lint>
879
880C<B::Lint> is now based on C<Module::Pluggable>, and so can be extended
881with plugins. (Joshua ben Jore)
882
883=item C<B>
884
885It's now possible to access the lexical pragma hints (C<%^H>) by using the
886method B::COP::hints_hash(). It returns a C<B::RHE> object, which in turn
887can be used to get a hash reference via the method B::RHE::HASH(). (Joshua
888ben Jore)
889
890=item C<Thread>
891
892As the old 5005thread threading model has been removed, in favor of the
893ithreads scheme, the C<Thread> module is now a compatibility wrapper, to
894be used in old code only. It has been removed from the default list of
895dynamic extensions.
896
0eece9c0
RGS
897=back
898
cf6c151c 899=head1 Utility Changes
c0c97549
RGS
900
901=over 4
902
bd3831ee 903=item perl -d
c0c97549
RGS
904
905The Perl debugger can now save all debugger commands for sourcing later;
906notably, it can now emulate stepping backwards, by restarting and
907rerunning all bar the last command from a saved command history.
908
909It can also display the parent inheritance tree of a given class, with the
910C<i> command.
911
bd3831ee
RGS
912=item ptar
913
292c2b28 914C<ptar> is a pure perl implementation of C<tar> that comes with
bd3831ee
RGS
915C<Archive::Tar>.
916
917=item ptardiff
918
254a8700 919C<ptardiff> is a small utility used to generate a diff between the contents
bd3831ee
RGS
920of a tar archive and a directory tree. Like C<ptar>, it comes with
921C<Archive::Tar>.
922
923=item shasum
924
925C<shasum> is a command-line utility, used to print or to check SHA
926digests. It comes with the new C<Digest::SHA> module.
927
928=item corelist
0eece9c0
RGS
929
930The C<corelist> utility is now installed with perl (see L</"New modules">
931above).
932
bd3831ee 933=item h2ph and h2xs
0eece9c0 934
254a8700 935C<h2ph> and C<h2xs> have been made more robust with regard to
0eece9c0
RGS
936"modern" C code.
937
bd3831ee
RGS
938C<h2xs> implements a new option C<--use-xsloader> to force use of
939C<XSLoader> even in backwards compatible modules.
940
941The handling of authors' names that had apostrophes has been fixed.
942
943Any enums with negative values are now skipped.
944
945=item perlivp
946
947C<perlivp> no longer checks for F<*.ph> files by default. Use the new C<-a>
948option to run I<all> tests.
949
950=item find2perl
0eece9c0
RGS
951
952C<find2perl> now assumes C<-print> as a default action. Previously, it
953needed to be specified explicitly.
954
955Several bugs have been fixed in C<find2perl>, regarding C<-exec> and
956C<-eval>. Also the options C<-path>, C<-ipath> and C<-iname> have been
957added.
958
597bb945
RGS
959=item config_data
960
961C<config_data> is a new utility that comes with C<Module::Build>. It
962provides a command-line interface to the configuration of Perl modules
963that use Module::Build's framework of configurability (that is,
964C<*::ConfigData> modules that contain local configuration information for
965their parent modules.)
966
f00638a2 967=item cpanp
f0e260b8 968
254a8700 969C<cpanp>, the CPANPLUS shell, has been added. (C<cpanp-run-perl>, a
f0e260b8
RGS
970helper for CPANPLUS operation, has been added too, but isn't intended for
971direct use).
972
f00638a2 973=item cpan2dist
f0e260b8 974
292c2b28 975C<cpan2dist> is a new utility that comes with CPANPLUS. It's a tool to
f0e260b8
RGS
976create distributions (or packages) from CPAN modules.
977
f00638a2 978=item pod2html
f0e260b8
RGS
979
980The output of C<pod2html> has been enhanced to be more customizable via
981CSS. Some formatting problems were also corrected. (Jari Aalto)
982
c0c97549
RGS
983=back
984
cf6c151c 985=head1 New Documentation
c0c97549 986
597bb945
RGS
987The L<perlpragma> manpage documents how to write one's own lexical
988pragmas in pure Perl (something that is possible starting with 5.9.4).
989
bd3831ee
RGS
990The new L<perlglossary> manpage is a glossary of terms used in the Perl
991documentation, technical and otherwise, kindly provided by O'Reilly Media,
992Inc.
993
597bb945
RGS
994The L<perlreguts> manpage, courtesy of Yves Orton, describes internals of the
995Perl regular expression engine.
996
62c26f88
RGS
997The L<perlreapi> manpage describes the interface to the perl interpreter
998used to write pluggable regular expression engines (by Ævar Arnfjörð
999Bjarmason).
1000
597bb945
RGS
1001The L<perlunitut> manpage is an tutorial for programming with Unicode and
1002string encodings in Perl, courtesy of Juerd Waalboer.
1003
f0e260b8
RGS
1004A new manual page, L<perlunifaq> (the Perl Unicode FAQ), has been added
1005(Juerd Waalboer).
1006
dbef3c66
RGS
1007The L<perlcommunity> manpage gives a description of the Perl community
1008on the Internet and in real life. (Edgar "Trizor" Bering)
1009
f00638a2
RGS
1010The L<CORE> manual page documents the C<CORE::> namespace. (Tels)
1011
c0c97549
RGS
1012The long-existing feature of C</(?{...})/> regexps setting C<$_> and pos()
1013is now documented.
1014
cf6c151c 1015=head1 Performance Enhancements
c0c97549 1016
597bb945 1017=head2 In-place sorting
0eece9c0 1018
c0c97549
RGS
1019Sorting arrays in place (C<@a = sort @a>) is now optimized to avoid
1020making a temporary copy of the array.
1021
0eece9c0
RGS
1022Likewise, C<reverse sort ...> is now optimized to sort in reverse,
1023avoiding the generation of a temporary intermediate list.
1024
597bb945 1025=head2 Lexical array access
0eece9c0 1026
c0c97549
RGS
1027Access to elements of lexical arrays via a numeric constant between 0 and
1028255 is now faster. (This used to be only the case for global arrays.)
1029
597bb945 1030=head2 XS-assisted SWASHGET
bd3831ee
RGS
1031
1032Some pure-perl code that perl was using to retrieve Unicode properties and
1033transliteration mappings has been reimplemented in XS.
1034
597bb945 1035=head2 Constant subroutines
bd3831ee
RGS
1036
1037The interpreter internals now support a far more memory efficient form of
1038inlineable constants. Storing a reference to a constant value in a symbol
1039table is equivalent to a full typeglob referencing a constant subroutine,
1040but using about 400 bytes less memory. This proxy constant subroutine is
1041automatically upgraded to a real typeglob with subroutine if necessary.
1042The approach taken is analogous to the existing space optimisation for
1043subroutine stub declarations, which are stored as plain scalars in place
1044of the full typeglob.
1045
1046Several of the core modules have been converted to use this feature for
1047their system dependent constants - as a result C<use POSIX;> now takes about
1048200K less memory.
1049
597bb945 1050=head2 C<PERL_DONT_CREATE_GVSV>
bd3831ee
RGS
1051
1052The new compilation flag C<PERL_DONT_CREATE_GVSV>, introduced as an option
1053in perl 5.8.8, is turned on by default in perl 5.9.3. It prevents perl
4cd37d19 1054from creating an empty scalar with every new typeglob. See L<perl589delta>
bd3831ee
RGS
1055for details.
1056
597bb945 1057=head2 Weak references are cheaper
bd3831ee
RGS
1058
1059Weak reference creation is now I<O(1)> rather than I<O(n)>, courtesy of
1060Nicholas Clark. Weak reference deletion remains I<O(n)>, but if deletion only
1061happens at program exit, it may be skipped completely.
1062
597bb945 1063=head2 sort() enhancements
bd3831ee
RGS
1064
1065Salvador Fandiño provided improvements to reduce the memory usage of C<sort>
1066and to speed up some cases.
1067
597bb945
RGS
1068=head2 Memory optimisations
1069
1070Several internal data structures (typeglobs, GVs, CVs, formats) have been
1071restructured to use less memory. (Nicholas Clark)
1072
1073=head2 UTF-8 cache optimisation
1074
1075The UTF-8 caching code is now more efficient, and used more often.
1076(Nicholas Clark)
1077
1078=head2 Sloppy stat on Windows
1079
1080On Windows, perl's stat() function normally opens the file to determine
1081the link count and update attributes that may have been changed through
1082hard links. Setting ${^WIN32_SLOPPY_STAT} to a true value speeds up
1083stat() by not performing this operation. (Jan Dubois)
1084
597bb945
RGS
1085=head2 Regular expressions optimisations
1086
1087=over 4
1088
1089=item Engine de-recursivised
1090
1091The regular expression engine is no longer recursive, meaning that
1092patterns that used to overflow the stack will either die with useful
1093explanations, or run to completion, which, since they were able to blow
1094the stack before, will likely take a very long time to happen. If you were
1095experiencing the occasional stack overflow (or segfault) and upgrade to
1096discover that now perl apparently hangs instead, look for a degenerate
1097regex. (Dave Mitchell)
1098
1099=item Single char char-classes treated as literals
1100
1101Classes of a single character are now treated the same as if the character
1102had been used as a literal, meaning that code that uses char-classes as an
1103escaping mechanism will see a speedup. (Yves Orton)
1104
1105=item Trie optimisation of literal string alternations
1106
1107Alternations, where possible, are optimised into more efficient matching
1108structures. String literal alternations are merged into a trie and are
1109matched simultaneously. This means that instead of O(N) time for matching
1110N alternations at a given point, the new code performs in O(1) time.
1111A new special variable, ${^RE_TRIE_MAXBUF}, has been added to fine-tune
1112this optimization. (Yves Orton)
1113
1114B<Note:> Much code exists that works around perl's historic poor
1115performance on alternations. Often the tricks used to do so will disable
1116the new optimisations. Hopefully the utility modules used for this purpose
99d59c4d 1117will be educated about these new optimisations.
597bb945
RGS
1118
1119=item Aho-Corasick start-point optimisation
1120
1121When a pattern starts with a trie-able alternation and there aren't
e15dad31 1122better optimisations available, the regex engine will use Aho-Corasick
597bb945
RGS
1123matching to find the start point. (Yves Orton)
1124
0eece9c0
RGS
1125=back
1126
cf6c151c 1127=head1 Installation and Configuration Improvements
c0c97549 1128
597bb945
RGS
1129=head2 Configuration improvements
1130
1131=over 4
1132
1133=item C<-Dusesitecustomize>
bd3831ee 1134
0eece9c0 1135Run-time customization of @INC can be enabled by passing the
597bb945 1136C<-Dusesitecustomize> flag to Configure. When enabled, this will make perl
0eece9c0
RGS
1137run F<$sitelibexp/sitecustomize.pl> before anything else. This script can
1138then be set up to add additional entries to @INC.
1139
597bb945
RGS
1140=item Relocatable installations
1141
1142There is now Configure support for creating a relocatable perl tree. If
1143you Configure with C<-Duserelocatableinc>, then the paths in @INC (and
1144everything else in %Config) can be optionally located via the path of the
1145perl executable.
1146
1147That means that, if the string C<".../"> is found at the start of any
1148path, it's substituted with the directory of $^X. So, the relocation can
1149be configured on a per-directory basis, although the default with
1150C<-Duserelocatableinc> is that everything is relocated. The initial
1151install is done to the original configured prefix.
1152
1153=item strlcat() and strlcpy()
1154
1155The configuration process now detects whether strlcat() and strlcpy() are
1156available. When they are not available, perl's own version is used (from
1157Russ Allbery's public domain implementation). Various places in the perl
1158interpreter now use them. (Steve Peters)
1159
f0e260b8
RGS
1160=item C<d_pseudofork> and C<d_printf_format_null>
1161
1162A new configuration variable, available as C<$Config{d_pseudofork}> in
1163the L<Config> module, has been added, to distinguish real fork() support
1164from fake pseudofork used on Windows platforms.
1165
1166A new configuration variable, C<d_printf_format_null>, has been added,
1167to see if printf-like formats are allowed to be NULL.
1168
1169=item Configure help
1170
1171C<Configure -h> has been extended with the most commonly used options.
1172
597bb945
RGS
1173=back
1174
1175=head2 Compilation improvements
1176
1177=over 4
1178
1179=item Parallel build
0eece9c0 1180
bd3831ee
RGS
1181Parallel makes should work properly now, although there may still be problems
1182if C<make test> is instructed to run in parallel.
1183
597bb945
RGS
1184=item Borland's compilers support
1185
bd3831ee
RGS
1186Building with Borland's compilers on Win32 should work more smoothly. In
1187particular Steve Hay has worked to side step many warnings emitted by their
1188compilers and at least one C compiler internal error.
1189
597bb945
RGS
1190=item Static build on Windows
1191
f0e260b8
RGS
1192Perl extensions on Windows now can be statically built into the Perl DLL.
1193
1194Also, it's now possible to build a C<perl-static.exe> that doesn't depend
1195on the Perl DLL on Win32. See the Win32 makefiles for details.
1196(Vadim Konovalov)
bd3831ee 1197
69d2c521 1198=item ppport.h files
597bb945
RGS
1199
1200All F<ppport.h> files in the XS modules bundled with perl are now
1201autogenerated at build time. (Marcus Holland-Moritz)
1202
f0e260b8
RGS
1203=item C++ compatibility
1204
1205Efforts have been made to make perl and the core XS modules compilable
1206with various C++ compilers (although the situation is not perfect with
1207some of the compilers on some of the platforms tested.)
1208
597bb945
RGS
1209=item Support for Microsoft 64-bit compiler
1210
1211Support for building perl with Microsoft's 64-bit compiler has been
1212improved. (ActiveState)
1213
f0e260b8
RGS
1214=item Visual C++
1215
c01f0d41 1216Perl can now be compiled with Microsoft Visual C++ 2005 (and 2008 Beta 2).
f0e260b8
RGS
1217
1218=item Win32 builds
1219
1220All win32 builds (MS-Win, WinCE) have been merged and cleaned up.
1221
597bb945
RGS
1222=back
1223
1224=head2 Installation improvements
1225
1226=over 4
1227
1228=item Module auxiliary files
1229
1230README files and changelogs for CPAN modules bundled with perl are no
1231longer installed.
1232
1233=back
1234
bd3831ee
RGS
1235=head2 New Or Improved Platforms
1236
597bb945 1237Perl has been reported to work on Symbian OS. See L<perlsymbian> for more
bd3831ee
RGS
1238information.
1239
597bb945
RGS
1240Many improvements have been made towards making Perl work correctly on
1241z/OS.
1242
f0e260b8 1243Perl has been reported to work on DragonFlyBSD and MidnightBSD.
597bb945 1244
3af9ce7f
RGS
1245Perl has also been reported to work on NexentaOS
1246( http://www.gnusolaris.org/ ).
1247
bd3831ee
RGS
1248The VMS port has been improved. See L<perlvms>.
1249
d43695a1
RGS
1250Support for Cray XT4 Catamount/Qk has been added. See
1251F<hints/catamount.sh> in the source code distribution for more
1252information.
bd3831ee 1253
f0e260b8
RGS
1254Vendor patches have been merged for RedHat and Gentoo.
1255
1256DynaLoader::dl_unload_file() now works on Windows.
bd3831ee 1257
cf6c151c 1258=head1 Selected Bug Fixes
c0c97549 1259
bd3831ee
RGS
1260=over 4
1261
1262=item strictures in regexp-eval blocks
1263
c0c97549
RGS
1264C<strict> wasn't in effect in regexp-eval blocks (C</(?{...})/>).
1265
bd3831ee
RGS
1266=item Calling CORE::require()
1267
1268CORE::require() and CORE::do() were always parsed as require() and do()
1269when they were overridden. This is now fixed.
1270
1271=item Subscripts of slices
1272
1273You can now use a non-arrowed form for chained subscripts after a list
1274slice, like in:
1275
1276 ({foo => "bar"})[0]{foo}
1277
1278This used to be a syntax error; a C<< -> >> was required.
1279
1280=item C<no warnings 'category'> works correctly with -w
1281
1282Previously when running with warnings enabled globally via C<-w>, selective
1283disabling of specific warning categories would actually turn off all warnings.
1284This is now fixed; now C<no warnings 'io';> will only turn off warnings in the
1285C<io> class. Previously it would erroneously turn off all warnings.
1286
597bb945 1287=item threads improvements
bd3831ee
RGS
1288
1289Several memory leaks in ithreads were closed. Also, ithreads were made
1290less memory-intensive.
1291
597bb945
RGS
1292C<threads> is now a dual-life module, also available on CPAN. It has been
1293expanded in many ways. A kill() method is available for thread signalling.
1294One can get thread status, or the list of running or joinable threads.
1295
1296A new C<< threads->exit() >> method is used to exit from the application
1297(this is the default for the main thread) or from the current thread only
1298(this is the default for all other threads). On the other hand, the exit()
1299built-in now always causes the whole application to terminate. (Jerry
1300D. Hedden)
1301
bd3831ee
RGS
1302=item chr() and negative values
1303
1304chr() on a negative value now gives C<\x{FFFD}>, the Unicode replacement
1305character, unless when the C<bytes> pragma is in effect, where the low
20d131f3 1306eight bits of the value are used.
bd3831ee 1307
597bb945
RGS
1308=item PERL5SHELL and tainting
1309
1310On Windows, the PERL5SHELL environment variable is now checked for
1311taintedness. (Rafael Garcia-Suarez)
1312
1313=item Using *FILE{IO}
1314
1315C<stat()> and C<-X> filetests now treat *FILE{IO} filehandles like *FILE
1316filehandles. (Steve Peters)
1317
1318=item Overloading and reblessing
1319
1320Overloading now works when references are reblessed into another class.
1321Internally, this has been implemented by moving the flag for "overloading"
1322from the reference to the referent, which logically is where it should
1323always have been. (Nicholas Clark)
1324
1325=item Overloading and UTF-8
1326
1327A few bugs related to UTF-8 handling with objects that have
1328stringification overloaded have been fixed. (Nicholas Clark)
1329
1330=item eval memory leaks fixed
1331
1332Traditionally, C<eval 'syntax error'> has leaked badly. Many (but not all)
1333of these leaks have now been eliminated or reduced. (Dave Mitchell)
1334
1335=item Random device on Windows
1336
1337In previous versions, perl would read the file F</dev/urandom> if it
1338existed when seeding its random number generator. That file is unlikely
1339to exist on Windows, and if it did would probably not contain appropriate
1340data, so perl no longer tries to read it on Windows. (Alex Davies)
1341
1342=item PERLIO_DEBUG
1343
254a8700 1344The C<PERLIO_DEBUG> environment variable no longer has any effect for
597bb945
RGS
1345setuid scripts and for scripts run with B<-T>.
1346
1347Moreover, with a thread-enabled perl, using C<PERLIO_DEBUG> could lead to
1348an internal buffer overflow. This has been fixed.
1349
f0e260b8
RGS
1350=item PerlIO::scalar and read-only scalars
1351
1352PerlIO::scalar will now prevent writing to read-only scalars. Moreover,
1353seek() is now supported with PerlIO::scalar-based filehandles, the
1354underlying string being zero-filled as needed. (Rafael, Jarkko Hietaniemi)
1355
1356=item study() and UTF-8
1357
1358study() never worked for UTF-8 strings, but could lead to false results.
1359It's now a no-op on UTF-8 data. (Yves Orton)
1360
1361=item Critical signals
1362
1363The signals SIGILL, SIGBUS and SIGSEGV are now always delivered in an
1364"unsafe" manner (contrary to other signals, that are deferred until the
1365perl interpreter reaches a reasonably stable state; see
1366L<perlipc/"Deferred Signals (Safe Signals)">). (Rafael)
1367
1368=item @INC-hook fix
1369
1370When a module or a file is loaded through an @INC-hook, and when this hook
1371has set a filename entry in %INC, __FILE__ is now set for this module
1372accordingly to the contents of that %INC entry. (Rafael)
1373
1374=item C<-t> switch fix
1375
1376The C<-w> and C<-t> switches can now be used together without messing
254a8700 1377up which categories of warnings are activated. (Rafael)
f0e260b8
RGS
1378
1379=item Duping UTF-8 filehandles
1380
1381Duping a filehandle which has the C<:utf8> PerlIO layer set will now
1382properly carry that layer on the duped filehandle. (Rafael)
1383
1384=item Localisation of hash elements
1385
292c2b28 1386Localizing a hash element whose key was given as a variable didn't work
f0e260b8
RGS
1387correctly if the variable was changed while the local() was in effect (as
1388in C<local $h{$x}; ++$x>). (Bo Lindbergh)
1389
bd3831ee 1390=back
0eece9c0 1391
cf6c151c 1392=head1 New or Changed Diagnostics
c0c97549 1393
bd3831ee
RGS
1394=over 4
1395
d43695a1
RGS
1396=item Use of uninitialized value
1397
1398Perl will now try to tell you the name of the variable (if any) that was
1399undefined.
1400
bd3831ee
RGS
1401=item Deprecated use of my() in false conditional
1402
c0c97549
RGS
1403A new deprecation warning, I<Deprecated use of my() in false conditional>,
1404has been added, to warn against the use of the dubious and deprecated
1405construct
1406
1407 my $x if 0;
1408
1409See L<perldiag>. Use C<state> variables instead.
1410
bd3831ee
RGS
1411=item !=~ should be !~
1412
0eece9c0
RGS
1413A new warning, C<!=~ should be !~>, is emitted to prevent this misspelling
1414of the non-matching operator.
1415
bd3831ee
RGS
1416=item Newline in left-justified string
1417
0eece9c0
RGS
1418The warning I<Newline in left-justified string> has been removed.
1419
bd3831ee
RGS
1420=item Too late for "-T" option
1421
0eece9c0
RGS
1422The error I<Too late for "-T" option> has been reformulated to be more
1423descriptive.
1424
bd3831ee
RGS
1425=item "%s" variable %s masks earlier declaration
1426
1427This warning is now emitted in more consistent cases; in short, when one
1428of the declarations involved is a C<my> variable:
1429
1430 my $x; my $x; # warns
1431 my $x; our $x; # warns
1432 our $x; my $x; # warns
1433
1434On the other hand, the following:
1435
1436 our $x; our $x;
1437
1438now gives a C<"our" variable %s redeclared> warning.
1439
1440=item readdir()/closedir()/etc. attempted on invalid dirhandle
1441
1442These new warnings are now emitted when a dirhandle is used but is
1443either closed or not really a dirhandle.
1444
f0e260b8
RGS
1445=item Opening dirhandle/filehandle %s also as a file/directory
1446
1447Two deprecation warnings have been added: (Rafael)
1448
1449 Opening dirhandle %s also as a file
1450 Opening filehandle %s also as a directory
1451
f00638a2
RGS
1452=item Use of -P is deprecated
1453
1454Perl's command-line switch C<-P> is now deprecated.
1455
6601a838
RGS
1456=item v-string in use/require is non-portable
1457
1458Perl will warn you against potential backwards compatibility problems with
1459the C<use VERSION> syntax.
1460
bd3831ee
RGS
1461=item perl -V
1462
0eece9c0
RGS
1463C<perl -V> has several improvements, making it more useable from shell
1464scripts to get the value of configuration variables. See L<perlrun> for
1465details.
1466
bd3831ee
RGS
1467=back
1468
cf6c151c 1469=head1 Changed Internals
c0c97549 1470
16993b2e
JH
1471In general, the source code of perl has been refactored, tidied up,
1472and optimized in many places. Also, memory management and allocation
1473has been improved in several points.
1474
1475When compiling the perl core with gcc, as many gcc warning flags are
1476turned on as is possible on the platform. (This quest for cleanliness
1477doesn't extend to XS code because we cannot guarantee the tidiness of
1478code we didn't write.) Similar strictness flags have been added or
1479tightened for various other C compilers.
bd3831ee 1480
c0c97549
RGS
1481=head2 Reordering of SVt_* constants
1482
1483The relative ordering of constants that define the various types of C<SV>
1484have changed; in particular, C<SVt_PVGV> has been moved before C<SVt_PVLV>,
1485C<SVt_PVAV>, C<SVt_PVHV> and C<SVt_PVCV>. This is unlikely to make any
1486difference unless you have code that explicitly makes assumptions about that
1487ordering. (The inheritance hierarchy of C<B::*> objects has been changed
1488to reflect this.)
1489
254a8700
NC
1490=head2 Elimination of SVt_PVBM
1491
e1020413 1492Related to this, the internal type C<SVt_PVBM> has been removed. This
254a8700
NC
1493dedicated type of C<SV> was used by the C<index> operator and parts of the
1494regexp engine to facilitate fast Boyer-Moore matches. Its use internally has
1495been replaced by C<SV>s of type C<SVt_PVGV>.
1496
1497=head2 New type SVt_BIND
1498
1499A new type C<SVt_BIND> has been added, in readiness for the project to
1500implement Perl 6 on 5. There deliberately is no implementation yet, and
1501they cannot yet be created or destroyed.
1502
c0c97549
RGS
1503=head2 Removal of CPP symbols
1504
1505The C preprocessor symbols C<PERL_PM_APIVERSION> and
1506C<PERL_XS_APIVERSION>, which were supposed to give the version number of
1507the oldest perl binary-compatible (resp. source-compatible) with the
1508present one, were not used, and sometimes had misleading values. They have
1509been removed.
1510
1511=head2 Less space is used by ops
1512
1513The C<BASEOP> structure now uses less space. The C<op_seq> field has been
254a8700 1514removed and replaced by a single bit bit-field C<op_opt>. C<op_type> is now 9
c0c97549
RGS
1515bits long. (Consequently, the C<B::OP> class doesn't provide an C<seq>
1516method anymore.)
1517
1518=head2 New parser
1519
1520perl's parser is now generated by bison (it used to be generated by
1521byacc.) As a result, it seems to be a bit more robust.
1522
bd3831ee
RGS
1523Also, Dave Mitchell improved the lexer debugging output under C<-DT>.
1524
1525=head2 Use of C<const>
1526
1527Andy Lester supplied many improvements to determine which function
1528parameters and local variables could actually be declared C<const> to the C
1529compiler. Steve Peters provided new C<*_set> macros and reworked the core to
1530use these rather than assigning to macros in LVALUE context.
1531
1532=head2 Mathoms
1533
1534A new file, F<mathoms.c>, has been added. It contains functions that are
1535no longer used in the perl core, but that remain available for binary or
1536source compatibility reasons. However, those functions will not be
1537compiled in if you add C<-DNO_MATHOMS> in the compiler flags.
1538
1539=head2 C<AvFLAGS> has been removed
1540
1541The C<AvFLAGS> macro has been removed.
1542
1543=head2 C<av_*> changes
1544
1545The C<av_*()> functions, used to manipulate arrays, no longer accept null
1546C<AV*> parameters.
1547
597bb945
RGS
1548=head2 $^H and %^H
1549
1550The implementation of the special variables $^H and %^H has changed, to
254a8700 1551allow implementing lexical pragmas in pure Perl.
597bb945 1552
bd3831ee
RGS
1553=head2 B:: modules inheritance changed
1554
1555The inheritance hierarchy of C<B::> modules has changed; C<B::NV> now
1556inherits from C<B::SV> (it used to inherit from C<B::IV>).
1557
f0e260b8
RGS
1558=head2 Anonymous hash and array constructors
1559
1560The anonymous hash and array constructors now take 1 op in the optree
1561instead of 3, now that pp_anonhash and pp_anonlist return a reference to
20d131f3 1562an hash/array when the op is flagged with OPf_SPECIAL. (Nicholas Clark)
f0e260b8 1563
cf6c151c 1564=head1 Known Problems
c0c97549
RGS
1565
1566There's still a remaining problem in the implementation of the lexical
1567C<$_>: it doesn't work inside C</(?{...})/> blocks. (See the TODO test in
1568F<t/op/mydef.t>.)
1569
3af9ce7f
RGS
1570Stacked filetest operators won't work when the C<filetest> pragma is in
1571effect, because they rely on the stat() buffer C<_> being populated, and
1572filetest bypasses stat().
1573
a3d15f9a
RGS
1574=head2 UTF-8 problems
1575
1576The handling of Unicode still is unclean in several places, where it's
1577dependent on whether a string is internally flagged as UTF-8. This will
1578be made more consistent in perl 5.12, but that won't be possible without
1579a certain amount of backwards incompatibility.
1580
1581=head1 Platform Specific Problems
1582
48d64ccf
RGS
1583When compiled with g++ and thread support on Linux, it's reported that the
1584C<$!> stops working correctly. This is related to the fact that the glibc
1585provides two strerror_r(3) implementation, and perl selects the wrong
1586one.
1587
cf6c151c
RGS
1588=head1 Reporting Bugs
1589
a3d15f9a
RGS
1590If you find what you think is a bug, you might check the articles
1591recently posted to the comp.lang.perl.misc newsgroup and the perl
1592bug database at http://rt.perl.org/rt3/ . There may also be
1593information at http://www.perl.org/ , the Perl Home Page.
1594
1595If you believe you have an unreported bug, please run the B<perlbug>
1596program included with your release. Be sure to trim your bug down
1597to a tiny but sufficient test case. Your bug report, along with the
1598output of C<perl -V>, will be sent off to perlbug@perl.org to be
1599analysed by the Perl porting team.
1600
cf6c151c
RGS
1601=head1 SEE ALSO
1602
1603The F<Changes> file and the perl590delta to perl595delta man pages for
1604exhaustive details on what changed.
1605
1606The F<INSTALL> file for how to build Perl.
1607
1608The F<README> file for general stuff.
1609
1610The F<Artistic> and F<Copying> files for copyright information.
1611
1612=cut