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