bdae56ed761ef4e5083311532fb97b51e147b76e
[p5sagit/p5-mst-13.2.git] / pod / perl571delta.pod
1 =head1 NAME
2
3 perl571delta - what's new for perl v5.7.1
4
5 =head1 DESCRIPTION
6
7 This document describes differences between the 5.7.0 release and the
8 5.7.1 release.  
9
10 (To view the differences between the 5.6.0 release and the 5.7.0
11 release, see L<perl570delta>).
12
13 =head1 Security Vulnerability Closed
14
15 (This change was already made in 5.7.0 but bears repeating here.)
16
17 A potential security vulnerability in the optional suidperl component
18 of Perl was identified in August 2000.  suidperl is neither built nor
19 installed by default.  As of April 2001 the only known vulnerable
20 platform is Linux, most likely all Linux distributions.  CERT and
21 various vendors and distributors have been alerted about the vulnerability.
22 See http://www.cpan.org/src/5.0/sperl-2000-08-05/sperl-2000-08-05.txt
23 for more information.
24
25 The problem was caused by Perl trying to report a suspected security
26 exploit attempt using an external program, /bin/mail.  On Linux
27 platforms the /bin/mail program had an undocumented feature which
28 when combined with suidperl gave access to a root shell, resulting in
29 a serious compromise instead of reporting the exploit attempt.  If you
30 don't have /bin/mail, or if you have 'safe setuid scripts', or if
31 suidperl is not installed, you are safe.
32
33 The exploit attempt reporting feature has been completely removed from
34 all the Perl 5.7 releases (and will be gone also from the maintenance
35 release 5.6.1), so that particular vulnerability isn't there anymore.
36 However, further security vulnerabilities are, unfortunately, always
37 possible.  The suidperl code is being reviewed and if deemed too risky
38 to continue to be supported, it may be completely removed from future
39 releases.  In any case, suidperl should only be used by security
40 experts who know exactly what they are doing and why they are using
41 suidperl instead of some other solution such as sudo (see
42 http://www.courtesan.com/sudo/).
43
44 =head1 Incompatible Changes
45
46 =over 4
47
48 =item *
49
50 Although "you shouldn't do that", it was possible to write code that
51 depends on Perl's hashed key order (Data::Dumper does this).  The new
52 algorithm "One-at-a-Time" produces a different hashed key order.
53 More details are in L</"Performance Enhancements">.
54
55 =item *
56
57 The list of filenames from glob() (or <...>) is now by default sorted
58 alphabetically to be csh-compliant.  (bsd_glob() does still sort platform
59 natively, ASCII or EBCDIC, unless GLOB_ALPHASORT is specified.)
60
61 =back
62
63 =head1 Core Enhancements
64
65 =over 4
66
67 =item *
68
69 AUTOLOAD is now lvaluable, meaning that you can add the :lvalue attribute
70 to AUTOLOAD subroutines and you can assign to the AUTOLOAD return value.
71
72 =item *
73
74 IO is now by default done via PerlIO rather than system's "stdio".
75 PerlIO allows "layers" to be "pushed" onto a file handle to alter the
76 handle's behaviour.  Layers can be specified at open time via 3-arg
77 form of open:
78
79    open($fh,'>:crlf :utf8', $path) || ...
80
81 or on already opened handles via extended C<binmode>:
82
83    binmode($fh,':encoding(iso-8859-7)');
84
85 The built-in layers are: unix (low level read/write), stdio (as in
86 previous Perls), perlio (re-implementation of stdio buffering in a
87 portable manner), crlf (does CRLF <=> "\n" translation as on Win32,
88 but available on any platform).  A mmap layer may be available if
89 platform supports it (mostly UNIXes).
90
91 Layers to be applied by default may be specified via the 'open' pragma.
92
93 See L</"Installation and Configuration Improvements"> for the effects
94 of PerlIO on your architecture name.
95
96 =item *
97
98 File handles can be marked as accepting Perl's internal encoding of Unicode
99 (UTF-8 or UTF-EBCDIC depending on platform) by a pseudo layer ":utf8" :
100
101    open($fh,">:utf8","Uni.txt");
102
103 Note for EBCDIC users: the pseudo layer ":utf8" is badly named for you
104 since it's not UTF-8 what you will be getting but instead UTF-EBCDIC.
105 See http://www.unicode.org/unicode/reports/tr16/ for more information.
106 In future release this naming issue may or may not change.
107
108 =item *
109
110 File handles can translate character encodings from/to Perl's internal
111 Unicode form on read/write via the ":encoding()" layer.
112
113 =item *
114
115 File handles can be opened to "in memory" files held in Perl scalars via:
116
117    open($fh,'>', \$variable) || ...
118
119 =item *
120
121 Anonymous temporary files are available without need to
122 'use FileHandle' or other module via
123
124    open($fh,"+>", undef) || ...
125
126 That is a literal undef, not an undefined value.
127
128 =item *
129
130 The list form of C<open> is now implemented for pipes (at least on UNIX):
131
132    open($fh,"-|", 'cat', '/etc/motd')
133
134 creates a pipe, and runs the equivalent of exec('cat', '/etc/motd') in
135 the child process.
136
137 =item *
138
139 The following builtin functions are now overrideable: chop(), chomp(),
140 each(), keys(), pop(), push(), shift(), splice(), unshift().
141
142 =item *
143
144 Formats now support zero-padded decimal fields.
145
146 =item *
147
148 Perl now tries internally to use integer values in numeric conversions
149 and basic arithmetics (+ - * /) if the arguments are integers, and
150 tries also to keep the results stored internally as integers.
151 This change leads into often slightly faster and always less lossy
152 arithmetics (previously Perl always preferred floating point numbers
153 in its math)
154
155 =item *
156  
157 The printf() and sprintf() now support parameter reordering using the
158 C<%\d+\$> and C<*\d+\$> syntaxes.  For example
159
160     print "%2\$s %1\$s\n", "foo", "bar";
161
162 will print "bar foo\n"; This feature helps in writing
163 internationalised software.
164
165 =item *
166
167 Unicode in general should be now much more usable.  Unicode can be
168 used in hash keys, Unicode in regular expressions should work now,
169 Unicode in tr/// should work now (though tr/// seems to be a
170 particularly tricky to get right, so you have been warned)
171
172 =item *
173
174 The Unicode Character Database coming with Perl has been upgraded
175 to Unicode 3.1.  For more information, see http://www.unicode.org/,
176 and http://www.unicode.org/unicode/reports/tr27/
177
178 For developers interested in enhanching Perl's Unicode capabilities:
179 almost all the UCD files are included with the Perl distribution in
180 the lib/unicode subdirectory.  The most notable omission, for space
181 considerations, is the Unihan database.
182
183 =item *
184
185 The Unicode character classes \p{Blank} and \p{SpacePerl} have been
186 added.  "Blank" is like C isblank(), that is, it contains only
187 "horizontal whitespace" (the space character is, the newline isn't),
188 and the "SpacePerl" is the Unicode equivalent of C<\s> (\p{Space}
189 isn't, since that includes the vertical tabulator character, whereas
190 C<\s> doesn't.)
191
192 =back
193
194 =head2 Modules and Pragmata
195
196 =head2 New Modules
197
198 =over 4
199
200 =item *
201
202 B::Concise is a new compiler backend for walking the Perl syntax tree,
203 printing concise info about ops.  The output is highly customisable,
204 so customisable that B::Terse has been re-implemented in terms of
205 B::Concise.
206
207 =item *
208
209 Class::ISA for reporting the search path for a class's ISA tree,
210 from Sean Burke, has been added.
211
212 =item *
213
214 Cwd has now a split personality: if possible, an extension is used,
215 (this will hopefully be both faster and more secure and robust) but
216 if not possible, the familiar Perl library implementation is used.
217
218 =item *
219
220 Digest, a frontend module for calculating digests (checksums),
221 from Gisle Aas, has been added.
222
223 =item *
224
225 Digest::MD5 for calculating MD5 digests (checksums), from Gisle Aas,
226 has been added.
227
228 NOTE: the MD5 backward compatibility module is purposefully not
229 included since its use is discouraged.
230
231 =item *
232
233 Encode provides a mechanism to translate between different character
234 encodings.  Support for Unicode, ISO-8859-*, ASCII, CP*, KOI8-R, and
235 three variants of EBCDIC are compiled in to the module.  Several other
236 encodings (like Japanese, Chinese, and MacIntosh encodings) are
237 included and will be loaded at runtime.
238
239 Any encoding supported by Encode module is also available to the
240 ":encoding()" layer if PerlIO is used.
241
242 =item *
243
244 Filter::Simple is an easy-to-use frontend to Filter::Util::Call,
245 from Damian Conway.
246
247 =item *
248
249 Filter::Util::Call, from Paul Marquess, provides you with the
250 framework to write I<Source Filters> in Perl.  For most uses
251 the frontend Filter::Simple is to be preferred.
252
253 =item *
254
255 Locale::Constants, Locale::Country, Locale::Currency, and Locale::Language,
256 from Neil Bowers, have been added.  They provide the codes for various
257 locale standards, such as "fr" for France, "usd" for US Dollar, and
258 "jp" for Japanese.
259
260 =item *
261
262 MIME::Base64, from Gisle Aas, allows you to encode data in base64.
263
264 =item *
265
266 MIME::QuotedPrint, from Gisle Aas, allows you to encode data in
267 quoted-printable encoding.
268
269 MIME::QuotedPrint has been enhanced to provide the basic methods
270 necessary to use it with PerlIO::Via as in :
271
272  use MIME::QuotedPrint;
273  open($fh,">Via(MIME::QuotedPrint)",$path)
274
275 =item *
276
277 PerlIO::Scalar provides the IO to "in memory" perl scalars discussed
278 above.  It also serves as an example of a loadable layer.
279
280 =item *
281
282 PerlIO::Via acts as a PerlIO layer and wraps PerlIO layer
283 functionality provided by a class (typically implemented in
284 perl code).
285
286 =item *
287
288 Pod::Text::Overstrike, from Joe Smith, has been added.
289 It converts POD data to formatted overstrike text.
290
291 =item *
292
293 Switch from Damian Conway has been added.  Just by saying
294
295     use Switch;
296
297 you have C<switch> and C<case> available in Perl.
298
299 =item *
300
301 Text::Balanced from Damian Conway has been added, for
302 extracting delimited text sequences from strings.
303
304 =item *
305
306 Tie::RefHash::Nestable, from Edward Avis, allows storing hash references
307 (unlike the standard Tie::Refhash)
308
309 =item *
310
311 XS::Typemap is a test extension that exercises XS typemaps.
312 Nothing gets installed but for extension writers the code is
313 worth studying.
314
315 =back
316
317 =head2 Updated And Improved Modules and Pragmata
318
319 =over 4
320
321 =item *
322
323 B::Deparse should be now more robust (still far from providing a full
324 round trip for any random piece of Perl code).
325
326 =item *
327
328 Class::Struct has now compile-time features.
329
330 =item *
331
332 Math::BigFloat has undergone much fixing.  (The fixed Math::BigFloat
333 module is also available in CPAN for those who can't upgrade their Perl:
334 http://www.cpan.org/authors/id/J/JP/JPEACOCK/)
335
336 =item *
337
338 Devel::Peek now has an interface for the Perl memory statistics
339 (this works only if you are using perl's malloc, and if you have
340 compiled with debugging).
341
342 =item *
343
344 IO::Socket has now atmark() method, which returns true if the socket
345 is positioned at the out-of-band mark.  The method is also exportable
346 as a sockatmark() function.
347
348 =item
349
350 IO::Socket::INET has support for ReusePort option (if your platform
351 supports it).  The Reuse option has now an alias, ReuseAddr.
352
353 =item *
354
355 Net::Ping has been greatly enhanced.
356
357 =item *
358
359 The C<open> pragma allows layers other than ":raw" and ":crlf" when
360 using PerlIO.
361
362 =item *
363
364 POSIX::sigaction() is now much more flexible and robust.
365
366 =item *
367
368 The Test module has been significantly enhanced.  Its use is
369 greatly recommended for module writers.
370
371 =item *
372
373 The utf8:: name space (as in the pragma) provides various
374 Perl-callable functions to provide low level access to Perl's
375 internal Unicode representation.  At the moment only length()
376 has been implemented.
377
378 =back
379
380 The following modules have been upgraded from the versions at CPAN:
381 CPAN, CGI, DB::File, Getopt::Long, Pod::Man, Pod::Text, Storable,
382 Text-Tabs+Wrap.
383
384 =head1 Performance Enhancements
385
386 =over 4
387
388 =item *
389
390 Hashes now use Bob Jenkins "One-at-a-Time" hashing key algorithm
391 (http://burtleburtle.net/bob/hash/doobs.html).
392 This algorithm is reasonably fast while producing a much better spread
393 of values.  Hash values output from the algorithm on a hash of all
394 3-char printable ASCII keys comes much closer to passing the DIEHARD
395 random number generation tests.  According to perlbench, this change
396 has not affected the overall speed of Perl.
397
398 =item *
399
400 unshift() should now be noticeably faster.
401
402 =back
403
404 =head1 Utility Changes
405
406 =over 4
407
408 =item *
409
410 h2xs now produces template README.
411
412 =item *
413
414 s2p has been completely rewritten in Perl.  (It is in fact a full
415 implementation of sed in Perl.)
416
417 =item *
418
419 xsubpp now supports OUT keyword.
420
421 =back
422
423 =head1 New Documentation
424
425 =head2 perlclib
426
427 Internal replacements for standard C library functions.
428 (Interesting only for extension writers and Perl core hackers.)
429
430 =head2 perliol
431
432 Internals of PerlIO with layers.
433
434 =head2 README.aix
435
436 Documentation on compiling Perl on AIX has been added.  AIX has
437 several different C compilers and getting the right patch level
438 is essential.  On install README.aix will be installed as L<perlaix>.
439
440 =head2 README.bs2000
441
442 Documentation on compiling Perl on the POSIX-BC platform (an EBCDIC
443 mainframe environment) has been added.
444
445 This was formerly known as README.posix-bc but the name was considered
446 to be too confusing (it has nothing to do with the POSIX module or the
447 POSIX standard).  On install README.bs2000 will be installed as L<perlbs2000>.
448
449 =head2 README.macos
450
451 In perl 5.7.1 (and in the 5.6.1) the MacPerl sources have been
452 synchronised with the standard Perl sources.  To compile MacPerl
453 some additional steps are required, and this file documents those
454 steps.  On install README.macos will be installed as L<perlmacos>.
455
456 =head2 README.mpeix
457
458 The README.mpeix has been podified, which means that this information
459 about compiling and using Perl on the MPE/iX miniframe platform will
460 be installed as L<perlmpeix>.
461
462 =head2 README.solaris
463
464 README.solaris has been created and Solaris wisdom from elsewhere
465 in the Perl documentation has been collected there.  On install
466 README.solaris will be installed as L<perlsolaris>.
467
468 =head2 README.vos
469
470 The README.vos has been podified, which means that this information
471 about compiling and using Perl on the Stratus VOS miniframe platform
472 will be installed as L<perlvos>.
473
474 =head2 Porting/repository.pod
475
476 Documentation on how to use the Perl source repository has been added.
477
478 =head1 Performance Enhancements
479
480 =head1 Installation and Configuration Improvements
481
482 =over 4
483
484 =item *
485
486 Because PerlIO is now the default on most platforms, "-perlio" doesn't
487 get appended to the $Config{archname} (also known as $^O) anymore.
488 Instead, if you explicitly choose not to use perlio (Configure command
489 line option -Uuseperlio), you will get "-stdio" appended.
490
491 =item *
492
493 Another change related to the architecture name is that "-64all"
494 (-Duse64bitall, or "maximally 64-bit") is appended only if your pointers
495 are 64 bits wide.
496
497 =item *
498
499 APPLLIB_EXP, a less-know configuration-time definition, has been
500 documented.  It can be used to prepend site-specific directories
501 to Perl's default search path (@INC), see INSTALL for information.
502
503 =item *
504
505 Building Berkeley DB3 for compatibility modes for DB, NDBM, and ODBM
506 has been documented in INSTALL.
507
508 =item *
509
510 If you are on IRIX or Tru64 platforms, new profiling/debugging options
511 have been added, see L</perlhack> for more information about pixie and
512 Third Degree.
513
514 =back
515
516 =head2 New Or Improved Platforms
517
518 For the list of platforms known to support Perl,
519 see L<perlport/"Supported Platforms">.
520
521 =over 4
522
523 =item *
524
525 AIX dynamic loading should be now better supported.
526
527 =item *
528
529 After a long pause, AmigaOS has been verified to be happy with Perl.
530
531 =item *
532
533 EBCDIC platforms (z/OS, also known as OS/390, POSIX-BC, and VM/ESA)
534 have been regained.  Many test suite tests still fail and the
535 co-existence of Unicode and EBCDIC isn't quite settled, but the
536 situation is much better than with Perl 5.6.  See L<perlos390>,
537 L<perlbs2000> (for POSIX-BC), and L<perlvmesa> for more information.
538
539 =item *
540
541 In HP-UX 10.20 Perl threading is now working with the various threading
542 packages available for HP-UX.  See L<perlhpux> (or in the source
543 distribution, README.hpux) for more information.
544
545 =item *
546
547 MacOS Classic (MacPerl has of course been available since
548 perl 5.004 but now the source code bases of standard Perl
549 and MacPerl have been synchronised)
550
551 =item *
552
553 NCR MP-RAS
554
555 =item *
556
557 NonStop-UX
558
559 =item *
560
561 Amdahl UTS
562
563 =item *
564
565 z/OS (formerly known as OS/390, formerly known as MVS OE) has now
566 support for dynamic loading.  This is not selected by default,
567 however, you must specify -Dusedl in the arguments of Configure.
568
569 =back
570
571 =head2 Generic Improvements
572
573 =over 4
574
575 =item *
576
577 Configure no longer includes the DBM libraries (dbm, gdbm, db, ndbm)
578 when building the Perl binary.  The only exception to this is SunOS 4.x,
579 which needs them.
580
581 =item *
582
583 Some new Configure symbols, useful for extension writers:
584
585 =over 8
586
587 =item d_cmsghdr
588
589 For struct cmsghdr.
590
591 =item d_fcntl_can_lock
592
593 Whether fcntl() can be used for file locking.
594
595 =item d_fsync
596
597 =item d_getitimer
598
599 =item d_getpagsz
600
601 For getpagesize(), though you should prefer POSIX::sysconf(_SC_PAGE_SIZE))
602
603 =item d_msghdr_s
604
605 For struct msghdr.
606
607 =item need_va_copy
608
609 Whether one needs to use Perl_va_copy() to copy varargs.
610
611 =item d_readv
612
613 =item d_recvmsg
614
615 =item d_sendmsg
616
617 =item sig_size
618
619 The number of elements in an array needed to hold all the available signals.
620
621 =item d_sockatmark
622
623 =item d_strtoq
624
625 =item d_u32align
626
627 Whether one needs to access character data aligned by U32 sized pointers.
628
629 =item d_ualarm
630
631 =item d_usleep
632
633 =back
634
635 =item *
636
637 Removed Configure symbols: the PDP-11 memory model settings: huge,
638 large, medium, models.
639
640 =item *
641
642 SOCKS support is now much more robust.
643
644 =item *
645
646 If your file system supports symbolic links you can build Perl outside
647 of the source directory by
648         
649         mkdir /tmp/perl/build/directory
650         cd /tmp/perl/build/directory
651         sh /path/to/perl/source/Configure -Dmksymlinks ...
652
653 This will create in /tmp/perl/build/directory a tree of symbolic links
654 pointing to files in /path/to/perl/source.  The original files are left
655 unaffected.  After Configure has finished you can just say
656
657         make all test
658
659 and Perl will be built and tested, all in /tmp/perl/build/directory.
660
661 =back
662
663 =head1 Selected Bug Fixes
664
665 Numerous memory leaks have been hunted down.  Most importantly anonymous
666 subs used to leak quite a bit.
667
668 =over 4
669
670 =item *
671
672 The order of DESTROYS has been made more predictable.
673
674 =item *
675
676 mkdir() now ignores trailing slashes in the directory name,
677 as mandated by POSIX.
678
679 =item *
680
681 Attributes (like :shared) didn't work with our().
682
683 =item *
684
685 The PERL5OPT environment variable (for passing command line arguments
686 to Perl) didn't work for more than a single group of options.
687
688 =item *
689
690 All but the first argument of the IO syswrite() method are now optional.
691
692 =item *
693
694 Tie::ARRAY SPLICE method was broken.
695
696 =item *
697
698 vec() now tries to work with characters <= 255 when possible, but it leaves
699 higher character values in place.  In that case, if vec() was used to modify
700 the string, it is no longer considered to be utf8-encoded.
701
702 =back
703
704 =head2 Platform Specific Changes and Fixes
705
706 =over 4
707
708 =item *
709
710 Linux previously had problems related to sockaddrlen when using
711 accept(), revcfrom() (in Perl: recv()), getpeername(), and getsockname().
712
713 =item *
714
715 Previously DYNIX/ptx had problems in its Configure probe for non-blocking I/O.
716
717 =back
718
719 =head1 New or Changed Diagnostics
720
721 Two new debugging options have been added: if you have compiled your
722 Perl with debugging, you can use the -DT and -DR options to trace
723 tokenising and to add reference counts to displaying variables,
724 respectively.
725
726 =over 4
727
728 =item *
729
730 If an attempt to use a (non-blessed) reference as an array element
731 is made, a warning is given.
732
733 =item *
734
735 C<push @a;> and C<unshift @a;> (with no values to push or unshift)
736 now give a warning.  This may be a problem for generated and evaled
737 code.
738
739 =back
740
741 =head1 Changed Internals
742
743 =over 4
744
745 =item *
746
747 Some new APIs: ptr_table_clear(), ptr_table_free(), sv_setref_uv().
748 For the full list of the available APIs see L<perlapi>.
749
750 =item *
751
752 dTHR and djSP have been obsoleted; the former removed (because it's
753 a no-op) and the latter replaced with dSP.
754
755 =item *
756
757 Perl now uses system malloc instead of Perl malloc in all 64-bit
758 platforms.  This change breaks backward compatibility but Perl's
759 malloc has problems with large address spaces and also the speed of
760 vendors' malloc is generally better in large address space machines
761 (Perl's malloc is mostly tuned for space).
762
763 =back
764
765 =head1 Known Problems
766
767 =head2 lib/b test 19
768
769 The test fails in various platforms (PA64 and IA64 are known), but the
770 exact cause is still being investigated.
771
772 =head2 Localising a Tied Variable Leaks Memory
773
774     use Tie::Hash;
775     tie my %tie_hash => 'Tie::StdHash';
776
777     ...
778
779     local($tie_hash{Foo}) = 1; # leaks
780
781 Code like the above is known to leak memory every time the local()
782 is executed.
783
784 =head2 sigaction test 13 in VMS
785
786 The test is known to fail, whether it's because of VMS of because
787 of faulty test, is not known.
788
789 =head2 sprintf tests 129 and 130
790
791 The op/sprintf tests 129 and 130 are known to fail in some platforms.
792 Examples include any platform using sfio, and Tandem's NonStop-UX.
793 The failing platforms do not comply with the ANSI C Standard, line
794 19ff on page 134 of ANSI X3.159 1989 to be exact.  (They produce
795 something else than "1" and "-1" when formatting 0.6 and -0.6 using
796 the printf format "%.0f", most often they produce "0" and "-0".)
797
798 =head2 Self-tying of Arrays and Hashes Is Forbidden
799
800 Self-tying of arrays and hashes is broken in rather deep and
801 hard-to-fix ways.  As a stop-gap measure to avoid people from getting
802 frustrated at the mysterious results (core dumps, most often) it is
803 for now forbidden (you will get a fatal error even from an attempt).
804
805 =head1 Reporting Bugs
806
807 If you find what you think is a bug, you might check the articles
808 recently posted to the comp.lang.perl.misc newsgroup and the perl
809 bug database at http://bugs.perl.org.  There may also be
810 information at http://www.perl.com/perl/, the Perl Home Page.
811
812 If you believe you have an unreported bug, please run the B<perlbug>
813 program included with your release.  Be sure to trim your bug down
814 to a tiny but sufficient test case.  Your bug report, along with the
815 output of C<perl -V>, will be sent off to perlbug@perl.org to be
816 analysed by the Perl porting team.
817
818 =head1 SEE ALSO
819
820 The F<Changes> file for exhaustive details on what changed.
821
822 The F<INSTALL> file for how to build Perl.
823
824 The F<README> file for general stuff.
825
826 The F<Artistic> and F<Copying> files for copyright information.
827
828 =head1 HISTORY
829
830 Written by Jarkko Hietaniemi <F<jhi@iki.fi>>, with many contributions
831 from The Perl Porters and Perl Users submitting feedback and patches.
832
833 Send omissions or corrections to <F<perlbug@perl.org>>.
834
835 =cut