Mergesort is back.
[p5sagit/p5-mst-13.2.git] / pod / perldelta.pod
1 =head1 NAME
2
3 perldelta - what's new for perl v5.7.0
4
5 =head1 DESCRIPTION
6
7 This document describes differences between the 5.6.0 release and
8 the 5.7.0 release.
9
10 =head1 Security Vulnerability Closed
11
12 A potential security vulnerability in the optional suidperl component
13 of Perl has been identified.  suidperl is neither built nor installed
14 by default.  As of August the 20th, 2000, the only known vulnerable
15 platform is Linux, most likely all Linux distributions.  CERT and
16 various vendors have been alerted about the vulnerability.
17
18 The problem was caused by Perl trying to report a suspected security
19 exploit attempt using an external program, /bin/mail.  On Linux
20 platforms the /bin/mail program had an undocumented feature which gave
21 access to a root shell, resulting in a serious compromise instead of
22 reporting the exploit attempt.  If you don't have /bin/mail, or if you
23 have 'safe setuid scripts', or if suidperl is not installed, you
24 are safe.
25
26 The exploit attempt reporting feature has been completely removed from
27 the Perl 5.7.0 release, so that particular vulnerability isn't there
28 anymore.  However, further security vulnerabilities are,
29 unfortunately, always possible.  The suidperl code is being reviewed
30 and if deemed too risky to continue to be supported, it may be
31 completely removed from future releases.  In any case, suidperl should
32 only be used by security experts who know exactly what they are doing
33 and why they are using suidperl instead of some other solution such as
34 sudo (see http://www.courtesan.com/sudo/).
35
36 =head1 Incompatible Changes
37
38 =over 4
39
40 =item *
41
42 Arrays now always interpolate into double-quoted strings:
43 constructs like "foo@bar" now always assume C<@bar> is an array,
44 whether or not the compiler has seen use of C<@bar>.
45
46 =item *
47
48 The semantics of bless(REF, REF) were unclear and until someone proves
49 it to make some sense, it is forbidden.
50
51 =item *
52
53 The very dusty examples in the eg/ directory have been removed.
54 Suggestions for new shiny examples welcome but the main issue is that
55 the examples need to be documented, tested and (most importantly)
56 maintained.
57
58 =item *
59
60 The obsolete chat2 library that should never have been allowed
61 to escape the laboratory has been decommissioned.
62
63 =item *
64
65 The unimplemented POSIX regex features [[.cc.]] and [[=c=]] are still
66 recognised but now cause fatal errors.  The previous behaviour of
67 ignoring them by default and warning if requested was unacceptable
68 since it, in a way, falsely promised that the features could be used.
69
70 =item *
71
72 lstat(FILEHANDLE) now gives a warning because the operation makes no sense.
73 In future releases this may become a fatal error.
74
75 =item *
76
77 The long deprecated uppercase aliases for the string comparison
78 operators (EQ, NE, LT, LE, GE, GT) have now been removed.
79
80 =item *
81
82 The regular expression captured submatches ($1, $2, ...) are now
83 more consistently unset if the match fails, instead of leaving false
84 data lying around in them.
85
86 =item *
87
88 The tr///C and tr///U features have been removed and will not return;
89 the interface was a mistake.  Sorry about that.  For similar
90 functionality, see pack('U0', ...) and pack('C0', ...).
91
92 =back
93
94 =head1 Core Enhancements
95
96 =over 4
97
98 =item *
99
100 C<perl -d:Module=arg,arg,arg> now works (previously one couldn't pass
101 in multiple arguments.)
102
103 =item *
104
105 my __PACKAGE__ now works.
106
107 =item *
108
109 C<no Module;> now works even if there is no "sub unimport" in the Module.
110
111 =item *
112
113 The numerical comparison operators return C<undef> if either operand
114 is a NaN.  Previously the behaviour was unspecified.
115
116 =item *
117
118 C<pack('U0a*', ...)> can now be used to force a string to UTF8.
119
120 =item *
121
122 prototype(\&) is now available.
123
124 =item *
125
126 There is now an UNTIE method.
127
128 =back
129
130 =head1 Modules and Pragmata
131
132 =head2 New Modules
133
134 =over 4
135
136 =item *
137
138 File::Temp allows one to create temporary files and directories in an
139 easy, portable, and secure way.
140
141 =item *
142
143 Storable gives persistence to Perl data structures by allowing the
144 storage and retrieval of Perl data to and from files in a fast and
145 compact binary format.
146
147 =back
148
149 =head2 Updated And Improved Modules and Pragmata
150
151 =over 4
152
153 =item *
154
155 The following independently supported modules have been updated to
156 newer versions from CPAN: CGI, CPAN, DB_File, File::Spec, Getopt::Long,
157 the podlators bundle, Pod::LaTeX, Pod::Parser, Term::ANSIColor, Test.
158
159 =item *
160
161 Bug fixes and minor enhancements have been applied to B::Deparse,
162 Data::Dumper, IO::Poll, IO::Socket::INET, Math::BigFloat,
163 Math::Complex, Math::Trig, Net::protoent, the re pragma, SelfLoader,
164 Sys::SysLog, Test::Harness, Text::Wrap, UNIVERSAL, and the warnings
165 pragma.
166
167 =item *
168
169 The attributes::reftype() now works on tied arguments.
170
171 =item *
172
173 AutoLoader can now be disabled with C<no AutoLoader;>,
174
175 =item *
176
177 The English module can now be used without the infamous performance
178 hit by saying
179
180         use English '-no_performance_hit';
181
182 (Assuming, of course, that one doesn't need the troublesome variables
183 C<$`>, C<$&>, or C<$'>.)  Also, introduce C<@LAST_MATCH_START> and
184 C<@LAST_MATCH_END> English aliases for C<@-> and C<@+>.
185
186 =item *
187
188 File::Find now has pre- and post-processing callbacks.  It also
189 correctly changes directories when chasing symbolic links.  Callbacks
190 (naughtily) exiting with "next;" instead of "return;" now work.
191
192 =item *
193
194 File::Glob::glob() renamed to File::Glob::bsd_glob() to avoid
195 prototype mismatch with CORE::glob().
196
197 =item *
198
199 IPC::Open3 now allows the use of numeric file descriptors.
200
201 =item *
202
203 use lib now works identically to @INC.  Removing directories
204 with 'no lib' now works.
205
206 =item *
207
208 C<%INC> now localised in a Safe compartment so that use/require work.
209
210 =item *
211
212 The Shell module now has an OO interface.
213
214 =item *
215
216 =back
217
218 =head1 Utility Changes
219
220 =over 4
221
222 =item *
223
224 The Emacs perl mode (emacs/cperl-mode.el) has been updated to version 4.31.
225
226 =item *
227
228 Perlbug is now much more robust.  It also sends the bug report to perl.org,
229 not perl.com.
230
231 =item *
232
233 The perlcc utility has been rewritten and its user interface (that is,
234 command line) is much more like that of the UNIX C compiler, cc.
235
236 =item *
237
238 The xsubpp utility for extension writers now understands POD
239 documentation embedded in the *.xs files.
240
241 =back
242
243 =head1 New Documentation
244
245 =over 4
246
247 =item *
248
249 perl56delta details the changes between the 5.005 release and the
250 5.6.0 release.
251
252 =item *
253
254 perldebtut is a Perl debugging tutorial.
255
256 =item *
257
258 perlebcdic contains considerations for running Perl on EBCDIC platforms.
259 Note that unfortunately EBCDIC platforms that used to supported back in
260 Perl 5.005 are still unsupported by Perl 5.7.0; the plan, however, is to
261 bring them back to the fold.  
262
263 =item *
264
265 perlnewmod tells about writing and submitting a new module.
266
267 =item *
268
269 perlposix-bc explains using Perl on the POSIX-BC platform
270 (an EBCDIC mainframe platform).
271
272 =item *
273
274 perlretut is a regular expression tutorial.
275
276 =item *
277
278 perlrequick is a regular expressions quick-start guide.
279 Yes, much quicker than perlretut.
280
281 =item *
282
283 perlutil explains the command line utilities packaged with the Perl
284 distribution.
285
286 =back
287
288 =head1 Performance Enhancements
289
290 =over 4
291
292 =item *
293
294 map() that changes the size of the list should now work faster.
295
296 =item *
297  
298 sort() has been changed to use mergesort internally as opposed to the
299 earlier quicksort.  For very small lists this may result in slightly
300 slower sorting times, but in general the speedup should be at least 20%.
301 Additional bonuses are that the worst case behaviour of sort() is now
302 better (in computer science terms it now runs in time O(N log N), as
303 opposed to quicksorts Theta(N**2) worst-case run time behaviour), and
304 that sort() is now stable (meaning that elements with identical keys
305 will stay ordered as they were before the sort).
306
307 =back
308
309 =head1 Installation and Configuration Improvements
310
311 =head2 Generic Improvements
312
313 =over 4
314
315 =item *
316
317 INSTALL now explains how you can configure perl to use 64-bit
318 integers even on non-64-bit platforms.
319
320 =item *
321
322 Policy.sh policy change: if you are reusing a Policy.sh file (see
323 INSTALL) and you use Configure -Dprefix=/foo/bar and in the old
324 Policy $prefix eq $siteprefix and $prefix eq $vendorprefix, all of
325 them will now be changed to the new prefix, /foo/bar.  (Previously
326 only $prefix changed.)  If you do not like this new behaviour,
327 specify prefix, siteprefix, and vendorprefix explicitly.
328
329 =item *
330
331 A new optional location for Perl libraries, otherlibdirs, is available.
332 It can be used for example for vendor add-ons without disturbing Perl's
333 own library directories.
334
335 =item *
336
337 In many platforms the vendor-supplied 'cc' is too stripped-down to
338 build Perl (basically, 'cc' doesn't do ANSI C).  If this seems
339 to be the case and 'cc' does not seem to be the GNU C compiler
340 'gcc', an automatic attempt is made to find and use 'gcc' instead.
341
342 =item *
343
344 gcc needs to closely track the operating system release to avoid
345 build problems. If Configure finds that gcc was built for a different
346 operating system release than is running, it now gives a clearly visible
347 warning that there may be trouble ahead.
348
349 =item *
350
351 If binary compatibility with the 5.005 release is not wanted, Configure
352 no longer suggests including the 5.005 modules in @INC.
353
354 =item *
355
356 Configure C<-S> can now run non-interactively.
357
358 =item *
359
360 configure.gnu now works with options with whitespace in them.
361
362 =item *
363
364 installperl now outputs everything to STDERR.
365
366 =item *
367
368 $Config{byteorder} is now computed dynamically (this is more robust
369 with "fat binaries" where an executable image contains binaries for
370 more than one binary platform.)
371
372 =back
373
374 =head1 Selected Bug Fixes
375
376 =over 4
377
378 =item *
379
380 Several debugger fixes: exit code now reflects the script exit code,
381 condition C<"0"> now treated correctly, the C<d> command now checks
382 line number, the C<$.> no longer gets corrupted, all debugger output now
383 goes correctly to the socket if RemotePort is set.
384
385 =item *
386
387 C<*foo{FORMAT}> now works.
388
389 =item *
390
391 Lexical warnings now propagating correctly between scopes.
392
393 =item *
394
395 Line renumbering with eval and C<#line> now works.
396
397 =item *
398
399 Fixed numerous memory leaks, especially in eval "".
400
401 =item *
402
403 Modulus of unsigned numbers now works (4063328477 % 65535 used to
404 return 27406, instead of 27047).
405
406 =item *
407
408 Some "not a number" warnings introduced in 5.6.0 eliminated to be
409 more compatible with 5.005.  Infinity is now recognised as a number.
410
411 =item *
412
413 our() variables will not cause "will not stay shared" warnings.
414
415 =item *
416
417 pack "Z" now correctly terminates the string with "\0".
418
419 =item *
420
421 Fix password routines which in some shadow password platforms
422 (e.g. HP-UX) caused getpwent() to return every other entry.
423
424 =item *
425
426 printf() no longer resets the numeric locale to "C".
427
428 =item *
429
430 C<q(a\\b)> now parses correctly as C<'a\\b'>.
431
432 =item *
433
434 Printing quads (64-bit integers) with printf/sprintf now works
435 without the q L ll prefixes (assuming you are on a quad-capable platform).
436
437 =item *
438
439 Regular expressions on references and overloaded scalars now work.
440
441 =item *
442
443 scalar() now forces scalar context even when used in void context.
444
445 =item *
446         
447 sort() arguments are now compiled in the right wantarray context
448 (they were accidentally using the context of the sort() itself).
449
450 =item *
451
452 Changed the POSIX character class C<[[:space:]]> to include the (very
453 rare) vertical tab character.  Added a new POSIX-ish character class
454 C<[[:blank:]]> which stands for horizontal whitespace (currently,
455 the space and the tab).
456
457 =item *
458
459 $AUTOLOAD, sort(), lock(), and spawning subprocesses
460 in multiple threads simultaneously are now thread-safe.
461
462 =item *
463
464 Allow read-only string on left hand side of non-modifying tr///.
465
466 =item *
467
468 Several Unicode fixes (but still not perfect).
469
470 =over 8
471
472 =item *
473
474 BOMs (byte order marks) in the beginning of Perl files
475 (scripts, modules) should now be transparently skipped.
476 UTF16 encoded Perl files should now be read correctly.
477
478 =item *
479
480 The character tables have been updated to new Unicode 3.0 features.
481
482 =item *
483
484 chr() for values greater than 127 now create utf8 when under use
485 utf8.
486
487 =item *
488
489 Comparing with utf8 data does not magically upgrade non-utf8 data into
490 utf8.
491
492 =item *
493
494 C<IsAlnum>, C<IsAlpha>, and C<IsWord> now match titlecase.
495
496 =item *
497
498 Concatenation with the C<.> operator or via variable interpolation,
499 C<eq>, C<substr>, C<reverse>, C<quotemeta>, the C<x> operator,
500 substitution with C<s///>, single-quoted UTF8, should now work--in
501 theory.
502
503 =item *
504
505 The C<tr///> operator now works I<slightly> better but is still rather
506 broken.  Note that the C<tr///CU> functionality has been removed (but
507 see pack('U0', ...)).
508
509 =item *
510
511 Zero entries were missing from the Unicode classes like C<IsDigit>.
512
513 =back
514
515 =item *
516
517 UNIVERSAL::isa no longer caches methods incorrectly.  (This broke
518 the Tk extension with 5.6.0.)
519
520 =back
521
522 =head2 Platform Specific Changes and Fixes
523
524 =over 4
525
526 =item *
527
528 BSDI 4.*
529
530 Perl now works on post-4.0 BSD/OSes.
531
532 =item *
533
534 All BSDs
535
536 Setting C<$0> now works (as much as possible; see perlvar for details).
537
538 =item *
539
540 Cygwin
541
542 Numerous updates; currently synchronised with Cygwin 1.1.4.
543
544 =item *
545
546 EPOC
547
548 EPOC update after Perl 5.6.0.  See README.epoc.
549
550 =item *
551
552 FreeBSD 3.*
553
554 Perl now works on post-3.0 FreeBSDs.
555
556 =item *
557
558 HP-UX
559
560 README.hpux updated; C<Configure -Duse64bitall> now almost works.
561
562 =item *
563
564 IRIX
565
566 Numerous compilation flag and hint enhancements; accidental mixing
567 of 32-bit and 64-bit libraries (a doomed attempt) made much harder.
568
569 =item *
570
571 Linux
572
573 Long doubles should now work (see INSTALL).
574
575 =item *
576
577 MacOS Classic
578
579 Compilation of the standard Perl distribution in MacOS Classic should
580 now work if you have the Metrowerks development environment and
581 the missing Mac-specific toolkit bits.  Contact the macperl mailing
582 list for details.
583
584 =item *
585
586 MPE/iX
587
588 MPE/iX update after Perl 5.6.0.  See README.mpeix.
589
590 =item *
591
592 NetBSD/sparc
593
594 Perl now works on NetBSD/sparc.
595
596 =item *
597
598 OS/2
599
600 Now works with usethreads (see INSTALL).
601
602 =item *
603
604 Solaris
605
606 64-bitness using the Sun Workshop compiler now works.
607
608 =item *
609
610 Tru64 (aka Digital UNIX, aka DEC OSF/1)
611
612 The operating system version letter now recorded in $Config{osvers}.
613 Allow compiling with gcc (previously explicitly forbidden).  Compiling
614 with gcc still not recommended because buggy code results, even with
615 gcc 2.95.2.
616
617 =item *
618
619 Unicos
620
621 Fixed various alignment problems that lead into core dumps either
622 during build or later; no longer dies on math errors at runtime;
623 now using full quad integers (64 bits), previously was using 
624 only 46 bit integers for speed.
625
626 =item *
627
628 VMS
629
630 chdir() now works better despite a CRT bug; now works with MULTIPLICITY
631 (see INSTALL); now works with Perl's malloc.
632
633 =item *
634
635 Windows
636
637 =over 8
638
639 =item *
640
641 accept() no longer leaks memory.
642
643 =item *
644
645 Better chdir() return value for a non-existent directory.
646
647 =item *
648
649 New %ENV entries now propagate to subprocesses.
650
651 =item *
652
653 $ENV{LIB} now used to search for libs under Visual C.
654
655 =item *
656
657 A failed (pseudo)fork now returns undef and sets errno to EAGAIN.
658
659 =item *
660
661 Allow REG_EXPAND_SZ keys in the registry.
662
663 =item *
664
665 Can now send() from all threads, not just the first one.
666
667 =item *
668
669 Fake signal handling reenabled, bugs and all.
670
671 =item *
672
673 Less stack reserved per thread so that more threads can run
674 concurrently. (still 16M perl thread)
675
676 =item *
677
678 C<File::Spec->tmpdir()> now prefers C:/temp over /tmp
679 (works better when perl running as service).
680
681 =item *
682
683 Better UNC path handling under ithreads.
684
685 =item *
686
687 wait() and waitpid() now work much better.
688
689 =item *
690
691 winsock handle leak fixed.
692
693 =back
694
695 =head1 New or Changed Diagnostics
696
697 All regular expression compilation error messages are now hopefully
698 easier to understand both because the error message now comes before
699 the failed regex and because the point of failure is now clearly
700 marked.
701
702 The various "opened only for", "on closed", "never opened" warnings
703 drop the C<main::> prefix for filehandles in the C<main> package,
704 for example C<STDIN> instead of <main::STDIN>. 
705
706 The "Unrecognized escape" warning has been extended to include C<\8>,
707 C<\9>, and C<\_>.  There is no need to escape any of the C<\w> characters.
708
709 =head1 Changed Internals
710
711 =over 4
712
713 =item *
714
715 perlapi.pod (a companion to perlguts) now attempts to document the
716 internal API.
717
718 =item *
719
720 You can now build a really minimal perl called microperl.
721 Building microperl does not require even running Configure;
722 C<make -f Makefile.micro> should be enough.  Beware: microperl makes
723 many assumptions, some of which may be too bold; the resulting
724 executable may crash or otherwise misbehave in wondrous ways.  For
725 careful hackers only.
726
727 =item *
728
729 Added rsignal(), whichsig(), do_join() to the publicised API.
730
731 =item *
732
733 Made possible to propagate customised exceptions via croak()ing.
734
735 =item *
736
737 Added is_utf8_char(), is_utf8_string(), bytes_to_utf8(), and utf8_to_bytes().
738
739 =item *
740
741 Now xsubs can have attributes just like subs.
742
743 =back
744
745 =head1 Known Problems
746
747 =head2 Unicode Support Still Far From Perfect
748
749 We're working on it.  Stay tuned.
750
751 =head2 EBCDIC Still A Lost Platform
752
753 The plan is to bring them back.
754
755 =head2 Building Extensions Can Fail Because Of Largefiles
756
757 Certain extensions like mod_perl and BSD::Resource are known to have
758 issues with `largefiles', a change brought by Perl 5.6.0 in which file
759 offsets default to 64 bits wide, where supported.  Modules may fail to
760 compile at all or compile and work incorrectly.  Currently there is no
761 good solution for the problem, but Configure now provides appropriate
762 non-largefile ccflags, ldflags, libswanted, and libs in the %Config
763 hash (e.g., $Config{ccflags_nolargefiles}) so the extensions that are
764 having problems can try configuring themselves without the
765 largefileness.  This is admittedly not a clean solution, and the
766 solution may not even work at all.  One potential failure is whether
767 one can (or, if one can, whether it's a good idea) link together at
768 all binaries with different ideas about file offsets, all this is
769 platform-dependent.
770
771 =head2 ftmp-security tests warn 'system possibly insecure'
772
773 Don't panic.  Read INSTALL 'make test' section instead. 
774
775 =head2 Long Doubles Still Don't Work In Solaris
776
777 The experimental long double support is still very much so in Solaris.
778 (Other platforms like Linux and Tru64 are beginning to solidify in
779 this area.)
780
781 =head2 Storable tests fail in some platforms
782
783 If any Storable tests fail the use of Storable is not advisable.
784
785 =over 4
786
787 =item *
788
789 Many Storable tests fail on AIX configured with 64 bit integers.
790
791 So far unidentified problems break Storable in AIX if Perl is
792 configured to use 64 bit integers.  AIX in 32-bit mode works and
793 other 64-bit platforms work with Storable.
794
795 =item *
796
797 DOS DJGPP may hang when testing Storable.
798
799 =item *
800
801 st-06compat fails in UNICOS and UNICOS/mk.
802
803 This means that you cannot read old (pre-Storable-0.7) Storable images
804 made in other platforms.
805
806 =item *
807
808 st-store.t and st-retrieve may fail with Compaq C 6.2 on OpenVMS Alpha 7.2.
809
810 =head2 Threads Are Still Experimental
811
812 Multithreading is still an experimental feature.  Some platforms
813 emit the following message for lib/thr5005
814
815     #
816     # This is a KNOWN FAILURE, and one of the reasons why threading
817     # is still an experimental feature.  It is here to stop people
818     # from deploying threads in production. ;-)
819     #
820  
821 and another known warning is
822
823    pragma/overload......Unbalanced saves: 3 more saves than restores
824    panic: magic_mutexfree during global destruction.
825    ok
826    lib/selfloader.......Unbalanced saves: 3 more saves than restores
827    panic: magic_mutexfree during global destruction.
828    ok
829    lib/st-dclone........Unbalanced saves: 3 more saves than restores
830    panic: magic_mutexfree during global destruction.
831    ok
832
833 =head2 The Compiler Suite Is Still Experimental
834
835 The compiler suite is slowly getting better but is nowhere near yet.
836 The backend part that has seen perhaps the most progress is the
837 bytecode compiler.
838
839 =back
840
841 =head1 Reporting Bugs
842
843 If you find what you think is a bug, you might check the articles
844 recently posted to the comp.lang.perl.misc newsgroup and the perl
845 bug database at http://bugs.perl.org.  There may also be
846 information at http://www.perl.com/perl/, the Perl Home Page.
847
848 If you believe you have an unreported bug, please run the B<perlbug>
849 program included with your release.  Be sure to trim your bug down
850 to a tiny but sufficient test case.  Your bug report, along with the
851 output of C<perl -V>, will be sent off to perlbug@perl.org to be
852 analysed by the Perl porting team.
853
854 =head1 SEE ALSO
855
856 The F<Changes> file for exhaustive details on what changed.
857
858 The F<INSTALL> file for how to build Perl.
859
860 The F<README> file for general stuff.
861
862 The F<Artistic> and F<Copying> files for copyright information.
863
864 =head1 HISTORY
865
866 Written by Jarkko Hietaniemi <F<jhi@iki.fi>>, with many contributions
867 from The Perl Porters and Perl Users submitting feedback and patches.
868
869 Send omissions or corrections to <F<perlbug@perl.org>>.
870
871 =cut