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