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