Update perldelta.
[p5sagit/p5-mst-13.2.git] / pod / perldelta.pod
1 =head1 NAME
2
3 perldelta - what's new for perl v5.6 (as of v5.005_62)
4
5 =head1 DESCRIPTION
6
7 This is an unsupported alpha release, meant for intrepid Perl developers
8 only.  The included sources may not even build correctly on some platforms.
9 Subscribing to perl5-porters is the best way to monitor and contribute
10 to the progress of development releases (see www.perl.org for info).
11
12 This document describes differences between the 5.005 release and this one.
13
14 =head1 Incompatible Changes
15
16 =head2 Perl Source Incompatibilities
17
18 Beware that any new warnings that have been added are B<not> considered
19 incompatible changes.
20
21 Since all new warnings must be explicitly requested via the C<-w>
22 switch or the C<warnings> pragma, it is ultimately the programmer's
23 responsibility to ensure that warnings are enabled judiciously.
24
25 =over 4
26
27 =item Possibly changed pseudo-random number generator
28
29 In 5.005_0x and earlier, perl's rand() function used the C library
30 rand(3) function.  As of 5.005_52, Configure tests for drand48(),
31 random(), and rand() (in that order) and picks the first one it finds.
32 Perl programs that depend on reproducing a specific set of pseudo-random
33 numbers will now likely produce different output.
34
35 =item Hashing function for hash keys has changed
36
37 Perl hashes are not order preserving.  The apparently random order
38 encountered when iterating on the contents of a hash is determined
39 by the hashing algorithm used.  To improve the distribution of lower
40 bits in the hashed value, the algorithm has changed slightly as of
41 5.005_52.  When iterating over hashes, this may yield a random order
42 that is B<different> from that of previous versions.
43
44 =item C<undef> fails on read only values
45
46 Using the C<undef> operator on a readonly value (such as $1) has
47 the same effect as assigning C<undef> to the readonly value--it
48 throws an exception.
49
50 =item Close-on-exec bit may be set on pipe() handles
51
52 On systems that support a close-on-exec flag on filehandles, the
53 flag will be set for any handles created by pipe(), if that is
54 warranted by the value of $^F that may be in effect.  Earlier
55 versions neglected to set the flag for handles created with
56 pipe().  See L<perlfunc/pipe> and L<perlvar/$^F>.
57
58 =item Writing C<"$$1"> to mean C<"${$}1"> is unsupported
59
60 Perl 5.004 deprecated the interpretation of C<$$1> and
61 similar within interpolated strings to mean C<$$ . "1">,
62 but still allowed it.
63
64 In Perl 5.6 and later, C<"$$1"> always means C<"${$1}">.
65
66 =item values(%h) and C<\(%h)> operate on aliases to values, not copies
67
68 each(), values() and hashes in a list context return the actual
69 values in the hash, instead of copies (as they used to in earlier
70 versions).  Typical idioms for using these constructs copy the
71 returned values, but this is can make a significant difference when
72 creating references to the returned values.
73
74 Keys in the hash are still returned as copies when iterating on
75 on a hash.
76
77 =item vec(EXPR,OFFSET,BITS) enforces powers-of-two BITS
78
79 vec() generates a run-time error if the BITS arguments is not
80 a valid power-of-two integer.
81
82 =item Text of some diagnostic output has changed
83
84 Most references to internal Perl operations in diagnostics
85 have been changed to be more descriptive.  This may be an
86 issue for programs that may incorrectly rely on the exact
87 text of diagnostics for proper functioning.
88
89 =item C<%@> has been removed
90
91 The undocumented special variable C<%@> that used to accumulate
92 "background" errors (such as those that happen in DESTROY())
93 has been removed, because it could potentially result in memory
94 leaks.
95
96 =back
97
98 =head2 C Source Incompatibilities
99
100 =over 4
101
102 =item C<PERL_POLLUTE>
103
104 Release 5.005 grandfathered old global symbol names by providing preprocessor
105 macros for extension source compatibility.  As of release 5.6, these
106 preprocessor definitions are not available by default.  You need to explicitly
107 compile perl with C<-DPERL_POLLUTE> to get these definitions.  For
108 extensions still using the old symbols, this option can be
109 specified via MakeMaker:
110
111     perl Makefile.PL POLLUTE=1
112
113 =item C<PERL_IMPLICIT_CONTEXT>
114
115 This new build option provides a set of macros for all API functions
116 such that an implicit interpreter/thread context argument is passed to
117 every API function.  As a result of this, something like C<sv_setsv(foo,bar)>
118 amounts to a macro invocation that actually translates to something like
119 C<Perl_sv_setsv(my_perl,foo,bar)>.  While this is generally expected
120 to not have any significant source compatibility issues, the difference
121 between a macro and a real function call will need to be considered.
122
123 This means that there B<is> a source compatibility issue as a result of
124 this if your extensions attempt to use pointers to any of the Perl API
125 functions.
126
127 Note that the above issue is not relevant to the default build of
128 Perl, whose interfaces continue to match those of prior versions
129 (but subject to the other options described here).
130
131 PERL_IMPLICIT_CONTEXT is automatically enabled whenever Perl is built
132 with one of -Dusethreads, -Dusemultiplicity, or both.
133
134 See L<perlguts/"The Perl API"> for detailed information on the
135 ramifications of building Perl using this option.
136
137 =item C<PERL_POLLUTE_MALLOC>
138
139 Enabling Perl's malloc in release 5.005 and earlier caused
140 the namespace of system versions of the malloc family of functions to
141 be usurped by the Perl versions, since by default they used the
142 same names.
143
144 Besides causing problems on platforms that do not allow these functions to
145 be cleanly replaced, this also meant that the system versions could not
146 be called in programs that used Perl's malloc.  Previous versions of Perl
147 have allowed this behaviour to be suppressed with the HIDEMYMALLOC and
148 EMBEDMYMALLOC preprocessor definitions.
149
150 As of release 5.6, Perl's malloc family of functions have default names
151 distinct from the system versions.  You need to explicitly compile perl with
152 C<-DPERL_POLLUTE_MALLOC> to get the older behaviour.  HIDEMYMALLOC
153 and EMBEDMYMALLOC have no effect, since the behaviour they enabled is now
154 the default.
155
156 Note that these functions do B<not> constitute Perl's memory allocation API.
157 See L<perlguts/"Memory Allocation"> for further information about that.
158
159 =item C<PL_na> and C<dTHR> Issues
160
161 The C<PL_na> global is now thread local, so a C<dTHR> declaration is needed
162 in the scope in which the global appears.  XSUBs should handle this automatically,
163 but if you have used C<PL_na> in support functions, you either need to
164 change the C<PL_na> to a local variable (which is recommended), or put in
165 a C<dTHR>.
166
167 =back
168
169 =head2 Compatible C Source API Changes
170
171 =over
172
173 =item C<PATCHLEVEL> is now C<PERL_VERSION>
174
175 The cpp macros C<PERL_REVISION>, C<PERL_VERSION>, and C<PERL_SUBVERSION>
176 are now available by default from perl.h, and reflect the base revision,
177 patchlevel, and subversion respectively.  C<PERL_REVISION> had no
178 prior equivalent, while C<PERL_VERSION> and C<PERL_SUBVERSION> were
179 previously available as C<PATCHLEVEL> and C<SUBVERSION>.
180
181 The new names cause less pollution of the B<cpp> namespace and reflect what
182 the numbers have come to stand for in common practice.  For compatibility,
183 the old names are still supported when F<patchlevel.h> is explicitly
184 included (as required before), so there is no source incompatibility
185 from the change.
186
187 =item Support for C++ exceptions
188
189 change#3386, also needs perlguts documentation
190 [TODO - Chip Salzenberg <chip@perlsupport.com>]
191
192 =back
193
194 =head2 Binary Incompatibilities
195
196 The default build of this release is binary compatible with the 5.005
197 release or its maintenance versions.
198
199 The usethreads or usemultiplicity builds are B<not> binary compatible
200 with the corresponding builds in 5.005.
201
202 =head1 Installation and Configuration Improvements
203
204 =head2 New Configure flags
205
206 The following new flags may be enabled on the Configure command line
207 by running Configure with C<-Dflag>.
208
209     usemultiplicity
210
211     uselongdouble
212     usemorebits
213     uselargefiles
214
215 =head2 -Dusethreads and -Duse64bits now more daring
216
217 The Configure options enabling the use of threads and the use of
218 64-bitness are now more daring in the sense that they no more have
219 an explicit list of operating systems of known threads/64-bit
220 capabilities.  In other words: if your operating system has the
221 necessary APIs, you should be able just to go ahead and use them.
222 See also L<"64-bit support">.
223
224 =head2 Long Doubles
225
226 Some platforms have "long doubles", floating point numbers of even
227 larger range than ordinary "doubles".  To enable using ng doubles for
228 Perl's scalars, use -Duselongdouble.
229
230 =head2 -Dusemorebits
231
232 You can enable both -Duse64bits and -Dlongdouble by -Dusemorebits.
233 See also L<"64-bit support">.
234
235 =head2 -Duselargefiles
236
237 Some platforms support large files, files larger than two gigabytes.
238 See L<"Large file support"> for more information. 
239
240 =head2 installusrbinperl
241
242 You can use "Configure -Uinstallusrbinperl" which causes installperl
243 to skip installing perl also as /usr/bin/perl.  This is useful if you
244 prefer not to modify /usr/bin for some reason or another but harmful
245 because many scripts assume to find Perl in /usr/bin/perl.
246
247 =head2 SOCKS support
248
249 You can use "Configure -Dusesocks" which causes Perl to probe
250 for the SOCKS proxy protocol library, http://www.socks.nec.com/
251
252 =head2 C<-A> flag
253
254 You can "post-edit" the Configure variables using the Configure C<-A>
255 flag.  The editing happens immediately after the platform specific
256 hints files have been processed but before the actual configuration
257 process starts.  Run C<Configure -h> to find out the full C<-A> syntax.
258
259 =head2 New Installation Scheme
260
261 vendorprefix et al
262 [TODO - Andy Dougherty <doughera@lafcol.lafayette.edu>]
263
264 =head1 Core Changes
265
266 =head2 Unicode and UTF-8 support
267
268 Perl can optionally use UTF-8 as its internal representation for character
269 strings.  The C<utf8> pragma enables this support in the current lexical
270 scope.  See L<utf8> for more information.
271
272 =head2 Lexically scoped warning categories
273
274 You can now control the granularity of warnings emitted by perl at a finer
275 level using the C<use warnings> pragma.  See L<warnings> and L<perllexwarn>
276 for details.
277
278 =head2 Lvalue subroutines
279
280 WARNING: This is an experimental feature.
281
282 change#4081
283 [TODO - Ilya Zakharevich <ilya@math.ohio-state.edu>,
284 Tuomas Lukka <lukka@fas.harvard.edu>)]
285
286 =head2 "our" declarations
287
288 An "our" declaration introduces a value that can be best understood
289 as a lexically scoped symbolic alias to a global variable in the
290 current package.  This is mostly useful as an alternative to the
291 C<vars> pragma, but also provides the opportunity to introduce
292 typing and other attributes for such variables.  See L<perlfunc/our>.
293
294 =head2 Weak references
295
296 WARNING: This is an experimental feature.
297
298 change#3385, also need perlguts documentation
299
300 [TODO - Tuomas Lukka <lukka@fas.harvard.edu>]
301
302 =head2 Binary numbers supported
303
304 Binary numbers are now supported as literals, in s?printf formats, and
305 C<oct()>:
306
307     $answer = 0b101010;
308     printf "The answer is: %b\n", oct("0b101010");
309
310 =head2 Some arrows may be omitted in calls through references
311
312 Perl now allows the arrow to be omitted in many constructs
313 involving subroutine calls through references.  For example,
314 C<$foo[10]->('foo')> may now be written C<$foo[10]('foo')>.
315 This is rather similar to how the arrow may be omitted from
316 C<$foo[10]->{'foo'}>.  Note however, that the arrow is still
317 required for C<foo(10)->('bar')>.
318
319 =head2 syswrite() ease-of-use
320
321 The length argument of C<syswrite()> has become optional.
322
323 =head2 Filehandles can be autovivified
324
325 The construct C<open(my $fh, ...)> can be used to create filehandles
326 more easily.  The filehandle will be automatically closed at the end
327 of the scope of $fh, provided there are no other references to it.  This
328 largely eliminates the need for typeglobs when opening filehandles
329 that must be passed around, as in the following example:
330
331     sub myopen {
332         open my $fh, "@_"
333              or die "Can't open '@_': $!";
334         return $fh;
335     }
336
337     {
338         my $f = myopen("</etc/motd");
339         print <$f>;
340         # $f implicitly closed here
341     }
342
343 [TODO - this idiom needs more pod penetration]
344
345 =head2 64-bit support
346
347 All platforms that have 64-bit integers either (a) natively as longs
348 or ints (b) via special compiler flags (c) using long long are able to
349 use "quads" (64-integers) as follows:
350
351 =over 4
352
353 =item *
354
355 constants (decimal, hexadecimal, octal, binary) in the code 
356
357 =item *
358
359 arguments to oct() and hex()
360
361 =item *
362
363 arguments to print(), printf() and sprintf() (flag prefixes ll, L, q)
364
365 =item *
366
367 printed as such
368
369 =item *
370
371 pack() and unpack() "q" and "Q" formats
372
373 =item *
374
375 in basic arithmetics: + - * / %
376
377 =item *
378
379 vec() (but see the below note about bit arithmetics)
380
381 =back
382
383 Note that unless you have the case (a) you will have to configure
384 and compile Perl using the -Duse64bits Configure flag.
385
386 Unfortunately bit arithmetics (&, |, ^, ~, <<, >>) for numbers are not
387 64-bit clean, they are explictly forced to be 32-bit.  Bit arithmetics
388 for bit vectors (created by vec()) are not limited in their width.
389
390 Last but not least: note that due to Perl's habit of always using
391 floating point numbers the quads are still not true integers.
392 When quads overflow their limits (0...18_446_744_073_709_551_615 unsigned,
393 -9_223_372_036_854_775_808...9_223_372_036_854_775_807 signed), they
394 are silently promoted to floating point numbers, after which they will
395 start losing precision (their lower digits).
396
397 =head2 Large file support
398
399 If you have filesystems that support "large files" (files larger than
400 2 gigabytes), you may now also be able to create and access them from
401 Perl.  You have to use Configure -Duselargefiles.  Turning on the
402 large file support turns on also the 64-bit support, for obvious reasons.
403
404 Note that in addition to requiring a proper file system to do large
405 files you may also need to adjust your per-process (or your
406 per-system, or per-process-group, or per-user-group) maximum filesize
407 limits before running Perl scripts that try to handle large files,
408 especially if you intend to write such files.
409
410 Finally, in addition to your process/process group maximum filesize
411 limits, you may have quota limits on your filesystems that stop you
412 (your user id or your user group id) from using large files.
413
414 Adjusting your process/user/group/file system/operating system limits
415 is outside the scope of Perl core language.  For process limits, you
416 may try increasing the limits using your shell's limits/limit/ulimit
417 command before running Perl.  The BSD::Resource extension (not
418 included with the standard Perl distribution) may also be of use, it
419 offers the getrlimit/setrlimit interface that can be used to adjust
420 process resource usage limits, including the maximum filesize limit.
421  
422 =head2 Long doubles
423
424 In some systems you may be able to use long doubles to enhance the
425 range of precision of your double precision floating point numbers
426 (that is, Perl's numbers).  Use Configure -Duselongdouble to enable
427 this support (if it is available).
428
429 =head2 "more bits"
430
431 You can Configure -Dusemorebits to turn on both the 64-bit support
432 and the long double support.
433
434 =head2 Better syntax checks on parenthesized unary operators
435
436 Expressions such as:
437
438     print defined(&foo,&bar,&baz);
439     print uc("foo","bar","baz");
440     undef($foo,&bar);
441
442 used to be accidentally allowed in earlier versions, and produced
443 unpredictable behaviour.  Some produced ancillary warnings
444 when used in this way; others silently did the wrong thing.
445
446 The parenthesized forms of most unary operators that expect a single
447 argument now ensure that they are not called with more than one
448 argument, making the cases shown above syntax errors.  The usual
449 behaviour of:
450
451     print defined &foo, &bar, &baz;
452     print uc "foo", "bar", "baz";
453     undef $foo, &bar;
454
455 remains unchanged.  See L<perlop>.
456
457 =head2 POSIX character class syntax [: :] supported
458
459 For example to match alphabetic characters use /[[:alpha:]]/.
460 See L<perlre> for details.
461
462 =head2 Improved C<qw//> operator
463
464 The C<qw//> operator is now evaluated at compile time into a true list
465 instead of being replaced with a run time call to C<split()>.  This
466 removes the confusing misbehaviour of C<qw//> in scalar context, which
467 had inherited that behaviour from split().
468
469 Thus:
470
471     $foo = ($bar) = qw(a b c); print "$foo|$bar\n";
472
473 now correctly prints "3|a", instead of "2|a".
474
475 =head2 pack() format 'Z' supported
476
477 The new format type 'Z' is useful for packing and unpacking null-terminated
478 strings.  See L<perlfunc/"pack">.
479
480 =head2 pack() format modifier '!' supported
481
482 The new format type modifier '!' is useful for packing and unpacking
483 native shorts, ints, and longs.  See L<perlfunc/"pack">.
484
485 =head2 pack() and unpack() support counted strings
486
487 The template character '/' can be used to specify a counted string
488 type to be packed or unpacked.  See L<perlfunc/"pack">.
489
490 =head2 Comments in pack() templates
491
492 The '#' character in a template introduces a comment up to
493 end of the line.  This facilitates documentation of pack()
494 templates.
495
496 =head2 $^X variables may now have names longer than one character
497
498 Formerly, $^X was synonymous with ${"\cX"}, but $^XY was a syntax
499 error.  Now variable names that begin with a control character may be
500 arbitrarily long.  However, for compatibility reasons, these variables
501 I<must> be written with explicit braces, as C<${^XY}> for example.
502 C<${^XYZ}> is synonymous with ${"\cXYZ"}.  Variable names with more
503 than one control character, such as C<${^XY^Z}>, are illegal.
504
505 The old syntax has not changed.  As before, `^X' may be either a
506 literal control-X character or the two-character sequence `caret' plus
507 `X'.  When braces are omitted, the variable name stops after the
508 control character.  Thus C<"$^XYZ"> continues to be synonymous with
509 C<$^X . "YZ"> as before.
510
511 As before, lexical variables may not have names beginning with control
512 characters.  As before, variables whose names begin with a control
513 character are always forced to be in package `main'.  All such variables
514 are reserved for future extensions, except those that begin with
515 C<^_>, which may be used by user programs and are guaranteed not to
516 acquire special meaning in any future version of Perl.
517
518 =head2 C<use attrs> implicit in subroutine attributes
519
520 Formerly, if you wanted to mark a subroutine as being a method call or
521 as requiring an automatic lock() when it is entered, you had to declare
522 that with a C<use attrs> pragma in the body of the subroutine.
523 That can now be accomplished with a declaration syntax, like this:
524
525     sub mymethod : locked, method ;
526     ...
527     sub mymethod : locked, method {
528         ...
529     }
530
531 F<AutoSplit.pm> and F<SelfLoader.pm> have been updated to keep the attributes
532 with the stubs they provide.  See L<attributes>.
533
534 =head2 Regular expression improvements
535
536 change#2827,2373,2372,2365,1813,1800,4112,4158,4215,4301
537 [TODO - Ilya Zakharevich <ilya@math.ohio-state.edu>]
538
539 =head2 Overloading improvements
540
541 change#2150
542 [TODO - Ilya Zakharevich <ilya@math.ohio-state.edu>]
543
544 =head2 open() with more than two arguments
545
546 [TODO - Ilya Zakharevich <ilya@math.ohio-state.edu>]
547
548 =head2 Support for interpolating named characters
549
550 change#4052
551 [TODO - Ilya Zakharevich <ilya@math.ohio-state.edu>]
552
553 =head2 Experimental support form user-hooks in @INC
554
555 [TODO - Ken Fox <kfox@ford.com>]
556
557 =head2 C<require> and C<do> may be overridden
558
559 C<require> and C<do 'file'> operations may be overridden locally
560 by importing subroutines of the same name into the current package 
561 (or globally by importing them into the CORE::GLOBAL:: namespace).
562 Overriding C<require> will also affect C<use>, provided the override
563 is visible at compile-time.
564 See L<perlsub/"Overriding Built-in Functions">.
565
566 =head2 New variable $^C reflects C<-c> switch
567
568 C<$^C> contains a boolean that reflects whether perl is being run
569 in compile-only mode (i.e. via the C<-c> switch).  Since
570 BEGIN blocks are executed under such conditions, this variable
571 enables perl code to determine whether actions that make sense
572 only during normal running are warranted.  See L<perlvar>.
573
574 =head2 Optional Y2K warnings
575
576 If Perl is built with the cpp macro C<PERL_Y2KWARN> defined,
577 it emits optional warnings when concatenating the number 19
578 with another number.
579
580 This behavior must be specifically enabled when running Configure.
581 See L<INSTALL> and L<README.Y2K>.
582
583 =head1 Significant bug fixes
584
585 =head2 E<lt>HANDLEE<gt> on empty files
586
587 With C<$/> set to C<undef>, slurping an empty file returns a string of
588 zero length (instead of C<undef>, as it used to) the first time the
589 HANDLE is read.  Further reads yield C<undef>.
590
591 This means that the following will append "foo" to an empty file (it used
592 to do nothing):
593
594     perl -0777 -pi -e 's/^/foo/' empty_file
595
596 The behaviour of:
597
598     perl -pi -e 's/^/foo/' empty_file
599
600 is unchanged (it continues to leave the file empty).
601
602 =head2 C<eval '...'> improvements
603
604 Line numbers (as reflected by caller() and most diagnostics) within
605 C<eval '...'> were often incorrect when here documents were involved.
606 This has been corrected.
607
608 Lexical lookups for variables appearing in C<eval '...'> within
609 functions that were themselves called within an C<eval '...'> were
610 searching the wrong place for lexicals.  The lexical search now
611 correctly ends at the subroutine's block boundary.
612
613 Parsing of here documents used to be flawed when they appeared as
614 the replacement expression in C<eval 's/.../.../e'>.  This has
615 been fixed.
616
617 =head2 All compilation errors are true errors
618
619 Some "errors" encountered at compile time were by neccessity 
620 generated as warnings followed by eventual termination of the
621 program.  This enabled more such errors to be reported in a
622 single run, rather than causing a hard stop at the first error
623 that was encountered.
624
625 The mechanism for reporting such errors has been reimplemented
626 to queue compile-time errors and report them at the end of the
627 compilation as true errors rather than as warnings.  This fixes
628 error messages that used to leak through as warnings when code
629 was compiled at run time using C<eval STRING>, and allows such
630 errors to be reliably trapped using __DIE__ hooks.
631
632 =head2 Automatic flushing of output buffers
633
634 fork(), exec(), system(), qx//, and pipe open()s now flush buffers
635 of all files opened for output when the operation
636 was attempted.  This mostly eliminates confusing 
637 buffering mishaps suffered by users unaware of how Perl internally
638 handles I/O.
639
640 =head2 Better diagnostics on meaningless filehandle operations
641
642 Constructs such as C<open(E<lt>FHE<gt>)> and C<close(E<lt>FHE<gt>)>
643 are compile time errors.  Attempting to read from filehandles that
644 were opened only for writing will now produce warnings (just as
645 writing to read-only filehandles does).
646
647 =head2 Where possible, buffered data discarded from duped input filehandle
648
649 C<open(NEW, "E<lt>&OLD")> now attempts to discard any data that
650 was previously read and buffered in C<OLD> before duping the handle.
651 On platforms where doing this is allowed, the next read operation
652 on C<NEW> will return the same data as the corresponding operation
653 on C<OLD>.  Formerly, it would have returned the data from the start
654 of the following disk block instead.
655
656 =head2 system(), backticks and pipe open now reflect exec() failure
657
658 On Unix and similar platforms, system(), qx() and open(FOO, "cmd |")
659 etc., are implemented via fork() and exec().  When the underlying
660 exec() fails, earlier versions did not report the error properly,
661 since the exec() happened to be in a different process.
662
663 The child process now communicates with the parent about the
664 error in launching the external command, which allow these
665 constructs to return with their usual error value and set $!.
666
667 =head2 Implicitly closed filehandles are safer
668
669 Sometimes implicitly closed filehandles (as when they are localized,
670 and Perl automatically closes them on exiting the scope) could
671 inadvertently set $? or $!.  This has been corrected.
672
673 =head2 C<(\$)> prototype and C<$foo{a}>
674
675 An scalar reference prototype now correctly allows a hash or
676 array element in that slot.
677
678 =head2 Pseudo-hashes work better
679
680 Dereferencing some types of reference values in a pseudo-hash,
681 such as C<$ph->{foo}[1]>, was accidentally disallowed.  This has
682 been corrected.
683
684 When applied to a pseudo-hash element, exists() now reports whether
685 the specified value exists, not merely if the key is valid.
686
687 =head2 C<goto &sub> and AUTOLOAD
688
689 C<goto &sub> construct works correctly when C<&sub> happens
690 to be autoloaded.
691
692 =head2 C<-bareword> allowed under C<use integer>
693
694 The autoquoting of barewords preceded by C<-> did not work
695 in prior versions when the C<integer> pragma was enabled.
696 This has been fixed.
697
698 =head2 Boolean assignment operators are legal lvalues
699
700 Constructs such as C<($a ||= 2) += 1> are now allowed.
701
702 =head2 C<sort $coderef @foo> allowed
703
704 sort() did not accept a subroutine reference as the comparison
705 function in earlier versions.  This has been fixed.
706
707 =head2 Failures in DESTROY()
708
709 When code in a destructor threw an exception, it went unnoticed
710 in earlier versions of Perl, unless someone happened to be
711 looking in $@ just after the point the destructor happened to
712 run.  Such failures are now visible as warnings when warnings are
713 enabled.
714
715 =head2 Locale bugs fixed
716
717 printf() and sprintf() previously did reset the numeric locale
718 back to the default "C" locale.  This has been fixed.
719
720 Numbers formatted according to the local numeric locale
721 (such as using a decimal comma instead of a decimal dot) caused
722 "isn't numeric" warnings, even while the operations accessing
723 those numbers produced correct results.  The warnings are gone.
724
725 =head2 Memory leaks
726
727 The C<eval 'return sub {...}'> construct could sometimes leak
728 memory.  This has been fixed.
729
730 Operations that aren't filehandle constructors used to leak memory
731 when used on invalid filehandles.  This has been fixed.
732
733 Constructs that modified C<@_> could fail to deallocate values
734 in C<@_> and thus leak memory.  This has been corrected.
735
736 =head2 Spurious subroutine stubs after failed subroutine calls
737
738 Perl could sometimes create empty subroutine stubs when a
739 subroutine was not found in the package.  Such cases stopped
740 later method lookups from progressing into base packages.
741 This has been corrected.
742
743 =head2 Consistent numeric conversions
744
745 change#3378,3318
746 [TODO - Ilya Zakharevich <ilya@math.ohio-state.edu>]
747
748 =head2 Taint failures under C<-U>
749
750 When running in unsafe mode, taint violations could sometimes
751 cause silent failures.  This has been fixed.
752
753 =head2 END blocks and the C<-c> switch
754
755 Prior versions used to run BEGIN B<and> END blocks when Perl was
756 run in compile-only mode.  Since this is typically not the expected
757 behavior, END blocks are not executed when the C<-c> switch
758 is used.
759
760 Note that something resembling the previous behavior can still be
761 obtained by putting C<BEGIN { $^C = 0; exit; } at the very end of
762 the top level source file.
763
764 =head2 Potential to leak DATA filehandles
765
766 Using the C<__DATA__> token creates an implicit filehandle to
767 the file that contains the token.  It is the program's
768 responsibility to close it when it is done reading from it.
769
770 This caveat is now better explained in the documentation.
771 See L<perldata>.
772
773 =head2 Diagnostics follow STDERR
774
775 Diagnostic output now goes to whichever file the C<STDERR> handle
776 is pointing at, instead of always going to the underlying C runtime
777 library's C<stderr>.
778
779 =head2 Other fixes for better diagnostics
780
781 Line numbers are suppressed no more (under most likely circumstances)
782 during the global destruction phase.
783
784 Diagnostics emitted from code running in threads other than the main
785 thread are now accompanied by the thread ID.
786
787 Embedded null characters in diagnostics now actually show up.  They
788 used to truncate the message in prior versions.
789
790 $foo::a and $foo::b are now exempt from "possible typo" warnings only
791 if sort() is encountered in package foo.
792
793 Unrecognized alphabetic escapes encountered when parsing quoting
794 constructs now generate a warning, since they may take on new
795 semantics in later versions of Perl.
796
797 =head1 Performance enhancements
798
799 =head2 Simple sort() using { $a <=> $b } and the like are optimized
800
801 Many common sort() opertions using a simple inlined block are now
802 optimized for faster performance.
803
804 =head2 Optimized assignments to lexical variables
805
806 Certain operations in the RHS of assignment statements have been
807 optimized to directly set the lexical variable on the LHS,
808 eliminating redundant copying overheads.
809
810 =head2 Method lookups optimized
811
812 [TODO - Chip Salzenberg <chip@perlsupport.com>]
813
814 =head2 Faster mechanism to invoke XSUBs
815
816 change#4044,4125
817 [TODO - Ilya Zakharevich <ilya@math.ohio-state.edu>]
818
819 =head2 Perl_malloc() improvements
820
821 change#4237
822 [TODO - Ilya Zakharevich <ilya@math.ohio-state.edu>]
823
824 =head2 Faster subroutine calls
825
826 Minor changes in how subroutine calls are handled internally
827 provide marginal improvements in performance.
828
829 =head1 Platform specific changes
830
831 =head2 Additional supported platforms
832
833 =over 4
834
835 =item *
836
837 VM/ESA is now supported.
838
839 =item *
840
841 Siemens BS2000 is now supported under the POSIX Shell.
842
843 =item *
844
845 The Mach CThreads (NEXTSTEP, OPENSTEP) are now supported by the Thread
846 extension.
847
848 =item *
849
850 GNU/Hurd is now supported.
851
852 =item *
853
854 Rhapsody is now supported.
855
856 =item *
857
858 EPOC is is now supported (on Psion 5).
859
860 =back
861
862 =head2 DOS
863
864 [TODO - Laszlo Molnar <laszlo.molnar@eth.ericsson.se>]
865
866 =head2 OS/2
867
868 [TODO - Ilya Zakharevich <ilya@math.ohio-state.edu>]
869
870 =head2 VMS
871
872 [TODO - Charles Bailey <bailey@newman.upenn.edu>]
873
874 =head2 Win32
875
876 Site library searches failed to look for ".../site/5.XXX/lib"
877 if ".../site/5.XXXYY/lib" wasn't found.  This has been corrected.
878
879 When given a pathname that consists only of a drivename, such
880 as C<A:>, opendir() and stat() now use the current working
881 directory for the drive rather than the drive root.
882
883 The builtin XSUB functions in the Win32:: namespace are
884 documented.  See L<Win32>.
885
886 $^X now contains the full path name of the running executable.
887
888 A Win32::GetLongPathName() function is provided to complement
889 Win32::GetFullPathName() and Win32::GetShortPathName().  See L<Win32>.
890
891 POSIX::uname() is supported.
892
893 system(1,...) now returns true process IDs rather than process
894 handles.  kill() accepts any real process id, rather than strictly
895 return values from system(1,...).
896
897 The C<Shell> module is supported.
898
899 [TODO - GSAR]
900
901 =head1 New tests
902
903 =over 4
904
905 =item   lib/attrs
906
907 Compatibility tests for C<sub : attrs> vs the older C<use attrs>.
908
909 =item   lib/io_const
910
911 IO constants (SEEK_*, _IO*).
912
913 =item   lib/io_dir
914
915 Directory-related IO methods (new, read, close, rewind, tied delete).
916
917 =item   lib/io_multihomed
918
919 INET sockets with multi-homed hosts.
920
921 =item   lib/io_poll
922
923 IO poll().
924
925 =item   lib/io_unix
926
927 UNIX sockets.
928
929 =item   op/attrs
930
931 Regression tests for C<my ($x,@y,%z) : attrs> and <sub : attrs>.
932
933 =item   op/filetest
934
935 File test operators.
936
937 =item   op/lex_assign
938
939 Verify operations that access pad objects (lexicals and temporaries).
940
941 =back
942
943 =head1 Modules and Pragmata
944
945 =head2 Modules
946
947 =over 4
948
949 =item attributes
950
951 While used internally by Perl as a pragma, this module also
952 provides a way to fetch subroutine and variable attributes.
953 See L<attributes>.
954
955 =item B
956
957 [TODO - Vishal Bhatia <vishal@gol.com>,
958 Nick Ing-Simmons <nick@ni-s.u-net.com>]
959
960 =item ByteLoader
961
962 The ByteLoader is a dedicated extension to generate and run
963 Perl bytecode.  See L<ByteLoader>.
964
965 =item B
966
967 The Perl Compiler suite has been extensively reworked for this
968 release.
969
970 =item constant
971
972 References can now be used.  See L<constant>.
973
974 =item charnames
975
976 change#4052
977 [TODO - Ilya Zakharevich <ilya@math.ohio-state.edu>]
978
979 =item Data::Dumper
980
981 A C<Maxdepth> setting can be specified to avoid venturing
982 too deeply into data structures that may be very deep.
983 See L<Data::Dumper>.
984
985 Dumping C<qr//> objects works correctly.
986
987 =item DB
988
989 C<DB> is an experimental module that exposes a clean abstraction
990 to Perl's debugging API.
991
992 =item DB_File
993
994 [TODO - Paul Marquess <paul.marquess@bt.com>]
995
996 =item Devel::DProf
997
998 Devel::DProf, a Perl source code profiler has been added.  See L<DProf>.
999
1000 =item Dumpvalue
1001
1002 Added Dumpvalue module provides screen dumps of Perl data.
1003
1004 =item Benchmark
1005
1006 You can now run tests for I<n> seconds instead of guessing the right
1007 number of tests to run: e.g. timethese(-5, ...) will run each 
1008 code for at least 5 CPU seconds.  Zero as the "number of repetitions"
1009 means "for at least 3 CPU seconds".  The output format has also
1010 changed.  For example:
1011
1012 use Benchmark;$x=3;timethese(-5,{a=>sub{$x*$x},b=>sub{$x**2}})
1013
1014 will now output something like this:
1015
1016 Benchmark: running a, b, each for at least 5 CPU seconds...
1017          a:  5 wallclock secs ( 5.77 usr +  0.00 sys =  5.77 CPU) @ 200551.91/s (n=1156516)
1018          b:  4 wallclock secs ( 5.00 usr +  0.02 sys =  5.02 CPU) @ 159605.18/s (n=800686)
1019
1020 New features: "each for at least N CPU seconds...", "wallclock secs",
1021 and the "@ operations/CPU second (n=operations)".
1022
1023 change#4265,4266,4292
1024 [TODO - Barrie Slaymaker <barries@slaysys.com>]
1025
1026 =item Devel::Peek
1027
1028 The Devel::Peek module provides access to the internal representation
1029 of Perl variables and data.  It is a data debugging tool for the XS programmer.
1030
1031 =item ExtUtils::MakeMaker
1032
1033 change#4135, also needs docs in module pod
1034 [TODO - Ilya Zakharevich <ilya@math.ohio-state.edu>]
1035
1036 =item Fcntl
1037
1038 More Fcntl constants added: F_SETLK64, F_SETLKW64, O_LARGEFILE for
1039 large (more than 4G) file access (64-bit support is not yet
1040 working, though, so no need to get overly excited), Free/Net/OpenBSD
1041 locking behaviour flags F_FLOCK, F_POSIX, Linux F_SHLCK, and
1042 O_ACCMODE: the mask of O_RDONLY, O_WRONLY, and O_RDWR.
1043
1044 =item File::Compare
1045
1046 A compare_text() function has been added, which allows custom
1047 comparison functions.  See L<File::Compare>.
1048
1049 =item File::Find
1050
1051 File::Find now works correctly when the wanted() function is either
1052 autoloaded or is a symbolic reference.
1053
1054 A bug that cause File::Find to lose track of the working directory
1055 when pruning top-level directories has been fixed.
1056
1057 =item File::Spec
1058
1059 New methods have been added to the File::Spec module: devnull() returns
1060 the name of the null device (/dev/null on Unix) and tmpdir() the name of
1061 the temp directory (normally /tmp on Unix).  There are now also methods
1062 to convert between absolute and relative filenames: abs2rel() and
1063 rel2abs().  For compatibility with operating systems that specify volume
1064 names in file paths, the splitpath(), splitdir(), and catdir() methods
1065 have been added.
1066
1067 =item File::Spec::Functions
1068
1069 The new File::Spec::Functions modules provides a function interface
1070 to the File::Spec module.  Allows shorthand
1071
1072     $fullname = catfile($dir1, $dir2, $file);
1073
1074 instead of
1075
1076     $fullname = File::Spec->catfile($dir1, $dir2, $file);
1077
1078 =item Getopt::Long
1079
1080 [TODO - Johan Vromans <jvromans@squirrel.nl>]
1081
1082 =item IO
1083
1084 write() and syswrite() will now accept a single-argument
1085 form of the call, for consistency with Perl's syswrite().
1086
1087 You can now create a TCP-based IO::Socket::INET without forcing
1088 a connect attempt.  This allows you to configure its options
1089 (like making it non-blocking) and then call connect() manually.
1090
1091 A bug that prevented the IO::Socket::protocol() accessor
1092 from ever returning the correct value has been corrected.
1093
1094 =item JPL
1095
1096 Java Perl Lingo is now distributed with Perl.  See jpl/README
1097 for more information.
1098
1099 =item Math::BigInt
1100
1101 The logical operations C<E<lt>E<lt>>, C<E<gt>E<gt>>, C<&>, C<|>,
1102 and C<~> are now supported on bigints.
1103
1104 =item Math::Complex
1105
1106 The accessor methods Re, Im, arg, abs, rho, and theta can now also
1107 act as mutators (accessor $z->Re(), mutator $z->Re(3)).
1108
1109 =item Math::Trig
1110
1111 A little bit of radial trigonometry (cylindrical and spherical),
1112 radial coordinate conversions, and the great circle distance were added.
1113
1114 =item Pod::Parser
1115
1116 [TODO - Brad Appleton <bradapp@enteract.com>]
1117
1118 =item Pod::Text and Pod::Man
1119
1120 [TODO - Russ Allbery <rra@stanford.edu>]
1121
1122 =item SDBM_File
1123
1124 An EXISTS method has been added to this module (and sdbm_exists() has
1125 been added to the underlying sdbm library), so one can now call exists
1126 on an SDBM_File tied hash and get the correct result, rather than a
1127 runtime error.
1128
1129 A bug that may have caused data loss when more than one disk block
1130 happens to be read from the database in a single FETCH() has been
1131 fixed.
1132
1133 =item Time::Local
1134
1135 The timelocal() and timegm() functions used to silently return bogus
1136 results when the date exceeded the machine's integer range.  They
1137 now consistently croak() if the date falls in an unsupported range.
1138
1139 =item Win32
1140
1141 The error return value in list context has been changed for all functions
1142 that return a list of values.  Previously these functions returned a list
1143 with a single element C<undef> if an error occurred.  Now these functions
1144 return the empty list in these situations.  This applies to the following
1145 functions:
1146
1147     Win32::FsType
1148     Win32::GetOSVersion
1149
1150 The remaining functions are unchanged and continue to return C<undef> on
1151 error even in list context.
1152
1153 The Win32::SetLastError(ERROR) function has been added as a complement
1154 to the Win32::GetLastError() function.
1155
1156 The new Win32::GetFullPathName(FILENAME) returns the full absolute
1157 pathname for FILENAME in scalar context.  In list context it returns
1158 a two-element list containing the fully qualified directory name and
1159 the filename.
1160
1161 =item DBM Filters
1162
1163 A new feature called "DBM Filters" has been added to all the
1164 DBM modules--DB_File, GDBM_File, NDBM_File, ODBM_File, and SDBM_File.
1165 DBM Filters add four new methods to each DBM module:
1166
1167     filter_store_key
1168     filter_store_value
1169     filter_fetch_key
1170     filter_fetch_value
1171
1172 These can be used to filter key-value pairs before the pairs are
1173 written to the database or just after they are read from the database.
1174 See L<perldbmfilter> for further information.
1175
1176 =back
1177
1178 =head2 Pragmata
1179
1180 C<use attrs> is now obsolescent, and is only provided for
1181 backward-compatibility.  It's been replaced by the C<sub : attributes>
1182 syntax.  See L<perlsub/"Subroutine Attributes"> and L<attributes>.
1183
1184 C<use utf8> to enable UTF-8 and Unicode support.
1185
1186 C<use caller 'encoding'> allows modules to inherit pragmatic attributes
1187 from the caller's context.  C<encoding> is currently the only supported
1188 attribute.
1189
1190 Lexical warnings pragma, C<use warnings;>, to control optional warnings.
1191 See L<perllexwarn>.
1192
1193 C<use filetest> to control the behaviour of filetests (C<-r> C<-w>
1194 ...).  Currently only one subpragma implemented, "use filetest
1195 'access';", that uses access(2) or equivalent to check permissions
1196 instead of using stat(2) as usual.  This matters in filesystems
1197 where there are ACLs (access control lists): the stat(2) might lie,
1198 but access(2) knows better.
1199
1200 =head1 Utility Changes
1201
1202 =head2 h2ph
1203
1204 [TODO - Kurt Starsinic <kstar@chapin.edu>]
1205
1206 =head2 perlcc
1207
1208 C<perlcc> now supports the C and Bytecode backends.  By default,
1209 it generates output from the simple C backend rather than the
1210 optimized C backend.
1211
1212 Support for non-Unix platforms has been improved.
1213
1214 =head2 h2xs
1215
1216 change#4232
1217 [TODO - Ilya Zakharevich <ilya@math.ohio-state.edu>]
1218
1219 =head1 Documentation Changes
1220
1221 =over 4
1222
1223 =item perlopentut.pod
1224
1225 A tutorial on using open() effectively.
1226
1227 =item perlreftut.pod
1228
1229 A tutorial that introduces the essentials of references.
1230
1231 =item perltootc.pod
1232
1233 A tutorial on managing class data for object modules.
1234
1235 =item perlcompile.pod
1236
1237 An introduction to using the Perl Compiler suite.
1238
1239 =back
1240
1241 =head1 New Diagnostics
1242
1243 =item "my sub" not yet implemented
1244
1245 (F) Lexically scoped subroutines are not yet implemented.  Don't try that
1246 yet.
1247
1248 =item %s package attribute may clash with future reserved word: %s
1249
1250 (W) A lowercase attribute name was used that had a package-specific handler.
1251 That name might have a meaning to Perl itself some day, even though it
1252 doesn't yet.  Perhaps you should use a mixed-case attribute name, instead.
1253 See L<attributes>.
1254
1255 =item /%s/: Unrecognized escape \\%c passed through
1256
1257 (W) You used a backslash-character combination which is not recognized
1258 by Perl.  This combination appears in an interpolated variable or a
1259 C<'>-delimited regular expression.
1260
1261 =item Filehandle %s opened only for output
1262
1263 (W) You tried to read from a filehandle opened only for writing.  If you
1264 intended it to be a read-write filehandle, you needed to open it with
1265 "+E<lt>" or "+E<gt>" or "+E<gt>E<gt>" instead of with "E<lt>" or nothing.  If
1266 you intended only to read from the file, use "E<lt>".  See
1267 L<perlfunc/open>.
1268
1269 =item Invalid %s attribute: %s
1270
1271 The indicated attribute for a subroutine or variable was not recognized
1272 by Perl or by a user-supplied handler.  See L<attributes>.
1273
1274 =item Invalid %s attributes: %s
1275
1276 The indicated attributes for a subroutine or variable were not recognized
1277 by Perl or by a user-supplied handler.  See L<attributes>.
1278
1279 =item Invalid separator character %s in attribute list
1280
1281 (F) Something other than a comma or whitespace was seen between the
1282 elements of an attribute list.  If the previous attribute
1283 had a parenthesised parameter list, perhaps that list was terminated
1284 too soon.  See L<attributes>.
1285
1286 =item Missing command in piped open
1287
1288 (W) You used the C<open(FH, "| command")> or C<open(FH, "command |")>
1289 construction, but the command was missing or blank.
1290
1291 =item Missing name in "my sub"
1292
1293 (F) The reserved syntax for lexically scoped subroutines requires that they
1294 have a name with which they can be found.
1295
1296 =item Unrecognized escape \\%c passed through
1297
1298 (W) You used a backslash-character combination which is not recognized
1299 by Perl.
1300
1301 =item Unterminated attribute parameter in attribute list
1302
1303 (F) The lexer saw an opening (left) parenthesis character while parsing an
1304 attribute list, but the matching closing (right) parenthesis
1305 character was not found.  You may need to add (or remove) a backslash
1306 character to get your parentheses to balance.  See L<attributes>.
1307
1308 =item Unterminated attribute list
1309
1310 (F) The lexer found something other than a simple identifier at the start
1311 of an attribute, and it wasn't a semicolon or the start of a
1312 block.  Perhaps you terminated the parameter list of the previous attribute
1313 too soon.  See L<attributes>.
1314
1315 =item defined(@array) is deprecated
1316
1317 (D) defined() is not usually useful on arrays because it checks for an
1318 undefined I<scalar> value.  If you want to see if the array is empty,
1319 just use C<if (@array) { # not empty }> for example.  
1320
1321 =item defined(%hash) is deprecated
1322
1323 (D) defined() is not usually useful on hashes because it checks for an
1324 undefined I<scalar> value.  If you want to see if the hash is empty,
1325 just use C<if (%hash) { # not empty }> for example.  
1326
1327 =item Invalid separator character %s in subroutine attribute list
1328
1329 (F) Something other than a comma or whitespace was seen between the
1330 elements of a subroutine attribute list.  If the previous attribute
1331 had a parenthesised parameter list, perhaps that list was terminated
1332 too soon.
1333
1334 =item Possible Y2K bug: %s
1335
1336 (W) You are concatenating the number 19 with another number, which
1337 could be a potential Year 2000 problem.
1338
1339 =item Unterminated attribute parameter in subroutine attribute list
1340
1341 (F) The lexer saw an opening (left) parenthesis character while parsing a
1342 subroutine attribute list, but the matching closing (right) parenthesis
1343 character was not found.  You may need to add (or remove) a backslash
1344 character to get your parentheses to balance.
1345
1346 =item Unterminated subroutine attribute list
1347
1348 (F) The lexer found something other than a simple identifier at the start
1349 of a subroutine attribute, and it wasn't a semicolon or the start of a
1350 block.  Perhaps you terminated the parameter list of the previous attribute
1351 too soon.
1352
1353 =item /%s/ should probably be written as "%s"
1354
1355 (W) You have used a pattern where Perl expected to find a string,
1356 like in the first argument to C<join>.  Perl will treat the true
1357 or false result of matching the pattern against $_ as the string,
1358 which is probably not what you had in mind.
1359
1360 =item %s() called too early to check prototype
1361
1362 (W) You've called a function that has a prototype before the parser saw a
1363 definition or declaration for it, and Perl could not check that the call
1364 conforms to the prototype.  You need to either add an early prototype
1365 declaration for the subroutine in question, or move the subroutine
1366 definition ahead of the call to get proper prototype checking.  Alternatively,
1367 if you are certain that you're calling the function correctly, you may put
1368 an ampersand before the name to avoid the warning.  See L<perlsub>.
1369
1370 =head1 Obsolete Diagnostics
1371
1372 Todo.
1373
1374 =head1 BUGS
1375
1376 If you find what you think is a bug, you might check the headers of
1377 articles recently posted to the comp.lang.perl.misc newsgroup.
1378 There may also be information at http://www.perl.com/perl/, the Perl
1379 Home Page.
1380
1381 If you believe you have an unreported bug, please run the B<perlbug>
1382 program included with your release.  Make sure to trim your bug down
1383 to a tiny but sufficient test case.  Your bug report, along with the
1384 output of C<perl -V>, will be sent off to perlbug@perl.com to be
1385 analysed by the Perl porting team.
1386
1387 =head1 SEE ALSO
1388
1389 The F<Changes> file for exhaustive details on what changed.
1390
1391 The F<INSTALL> file for how to build Perl.
1392
1393 The F<README> file for general stuff.
1394
1395 The F<Artistic> and F<Copying> files for copyright information.
1396
1397 =head1 HISTORY
1398
1399 Written by Gurusamy Sarathy <F<gsar@activestate.com>>, with many
1400 contributions from The Perl Porters.
1401
1402 Send omissions or corrections to <F<perlbug@perl.com>>.
1403
1404 =cut