This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Better advertising.
[perl5.git] / pod / perldelta.pod
index d682460..181f234 100644 (file)
@@ -71,7 +71,8 @@ The C<my EXPR : ATTRS> syntax now applies variable attributes at
 run-time.  (Subroutine and C<our> variables still get attributes applied
 at compile-time.)  See L<attributes> for additional details.  In particular,
 however, this allows variable attributes to be useful for C<tie> interfaces,
-which was a deficiency of earlier releaes.
+which was a deficiency of earlier releases.  Note that the new semantics
+doesn't work with the Attribute::Handlers module (as of version 0.76).
 
 =head2 Socket Extension Dynamic in VMS
 
@@ -87,33 +88,31 @@ point format on OpenVMS Alpha, potentially breaking binary compatibility
 with external libraries or existing data.  G_FLOAT is still available as
 a configuration option.  The default on VAX (D_FLOAT) has not changed.
 
-=head2 Different Definition of the Unicode Character Classes \p{In...}
-
-As suggested by the Unicode consortium, the Unicode character classes
-now prefer I<scripts> as opposed to I<blocks> (as defined by Unicode);
-in Perl, when the C<\p{In....}> and the C<\p{In....}> regular expression
-constructs are used.  This has changed the definition of some of those
-character classes.
-
-The difference between scripts and blocks is that scripts are the
-glyphs used by a language or a group of languages, while the blocks
-are more artificial groupings of 256 characters based on the Unicode
-numbering.
-
-In general this change results in more inclusive Unicode character
-classes, but changes to the other direction also do take place:
-for example while the script C<Latin> includes all the Latin
-characters and their various diacritic-adorned versions, it
-does not include the various punctuation or digits (since they
-are not solely C<Latin>).
-
-Changes in the character class semantics may have happened if a script
-and a block happen to have the same name, for example C<Hebrew>.
-In such cases the script wins and C<\p{InHebrew}> now means the script
-definition of Hebrew.  The block definition in still available,
-though, by appending C<Block> to the name: C<\p{InHebrewBlock}> means
-what C<\p{InHebrew}> meant in perl 5.6.0.  For the full list
-of affected character classes, see L<perlunicode/Blocks>.
+=head2 New Unicode Properties
+
+Unicode I<scripts> are now supported. Scripts are similar to (and superior
+to) Unicode I<blocks>. The difference between scripts and blocks is that
+scripts are the glyphs used by a language or a group of languages, while
+the blocks are more artificial groupings of (mostly) 256 characters based
+on the Unicode numbering.
+
+In general, scripts are more inclusive, but not universally so. For
+example, while the script C<Latin> includes all the Latin characters and
+their various diacritic-adorned versions, it does not include the various
+punctuation or digits (since they are not solely C<Latin>).
+
+A number of other properties are now supported, including C<\p{L&}>,
+C<\p{Any}> C<\p{Assigned}>, C<\p{Unassigned}>, C<\p{Blank}> and
+C<\p{SpacePerl}> (along with their C<\P{...}> versions, of course).
+See L<perlunicode> for details, and more additions.
+
+The C<In> or C<Is> prefix to names used with the C<\p{...}> and C<\P{...}>
+are now almost always optional. The only exception is that a C<In> prefix
+is required to signify a Unicode block when a block name conflicts with a
+script name. For example, C<\p{Tibetan}> refers to the script, while
+C<\p{InTibetan}> refers to the block. When there is no name conflict, you
+can omit the C<In> from the block name (e.g. C<\p{BraillePatterns}>), but
+to be safe, it's probably best to always use the C<In>).
 
 =head2 Perl Parser Stress Tested
 
@@ -127,6 +126,13 @@ A reference to a reference now stringifies as "REF(0x81485ec)" instead
 of "SCALAR(0x81485ec)" in order to be more consistent with the return
 value of ref().
 
+=head2 pack/unpack D/F recycled
+
+The undocumented pack/unpack template letters D/F have been recycled
+for better use: now they stand for long double (if supported by the
+platform) and NV (Perl internal floating point type).  (They used
+to be aliases for f/d, but you never knew that.)
+
 =head2 Deprecations
 
 =over 4
@@ -143,6 +149,13 @@ to escape the laboratory has been decommissioned.
 
 =item *
 
+The builtin dump() function has probably outlived most of its
+usefulness.  The core-dumping functionality will remain in future
+available as an explicit call to C<CORE::dump()>, but in future
+releases the behaviour of an unqualified C<dump()> call may change.
+
+=item *
+
 The very dusty examples in the eg/ directory have been removed.
 Suggestions for new shiny examples welcome but the main issue is that
 the examples need to be documented, tested and (most importantly)
@@ -223,6 +236,13 @@ The tr///C and tr///U features have been removed and will not return;
 the interface was a mistake.  Sorry about that.  For similar
 functionality, see pack('U0', ...) and pack('C0', ...).
 
+=item *
+
+Earlier Perls treated "sub foo (@bar)" as equivalent to "sub foo (@)".
+The prototypes are now checked at compile-time for invalid characters.
+An optional warning is generated ("Illegal character in prototype...")
+but this may be upgraded to a fatal error in a future release.
+
 =back
 
 =head1 Core Enhancements
@@ -299,11 +319,19 @@ the child process.
 
 =back
 
-=head2 Signals Are Now Safe
+=head2 Safe Signals
 
 Perl used to be fragile in that signals arriving at inopportune moments
 could corrupt Perl's internal state.  Now Perl postpones handling of
-signals until it's safe.
+signals until it's safe (between opcodes).
+
+This change may have surprising side effects because signals no longer
+interrupt Perl instantly.  Perl will now first finish whatever it was
+doing, like finishing an internal operation (like sort()) or an
+external operation (like an I/O operation), and only then look at any
+arrived signals (and before starting the next operation).  No more corrupt
+internal state since the current operation is always finished first,
+but the signal may take more time to get heard.
 
 =head2 Unicode Overhaul
 
@@ -323,17 +351,19 @@ to Unicode 3.1.1.  For more information, see http://www.unicode.org/.
 
 For developers interested in enhancing Perl's Unicode capabilities:
 almost all the UCD files are included with the Perl distribution in
-the lib/unicore subdirectory.  The most notable omission, for space
+the F<lib/unicore subdirectory>.  The most notable omission, for space
 considerations, is the Unihan database.
 
 =item *
 
-The Unicode character classes \p{Blank} and \p{SpacePerl} have been
-added.  "Blank" is like C isblank(), that is, it contains only
-"horizontal whitespace" (the space character is, the newline isn't),
-and the "SpacePerl" is the Unicode equivalent of C<\s> (\p{Space}
-isn't, since that includes the vertical tabulator character, whereas
-C<\s> doesn't.)
+The properties \p{Blank} and \p{SpacePerl} have been added. "Blank" is like
+C isblank(), that is, it contains only "horizontal whitespace" (the space
+character is, the newline isn't), and the "SpacePerl" is the Unicode
+equivalent of C<\s> (\p{Space} isn't, since that includes the vertical
+tabulator character, whereas C<\s> doesn't.)
+
+See "New Unicode Properties" earlier in this document for additional
+information on changes with Unicode properties.
 
 =back
 
@@ -352,7 +382,7 @@ This change leads to often slightly faster and always less lossy
 arithmetics. (Previously Perl always preferred floating point numbers
 in its math.)
 
-=head2 Miscellaneous Enhancements
+=head2 Miscellaneous Changes
 
 =over 4
 
@@ -368,6 +398,23 @@ in multiple arguments.)
 
 =item *
 
+The builtin dump() now gives an optional warning
+C<dump() better written as CORE::dump()>,
+meaning that by default C<dump(...)> is resolved as the builtin 
+dump() which dumps core and aborts, not as (possibly) user-defined
+C<sub dump>.  To call the latter, qualify the call as C<&dump(...)>.
+(The whole dump() feature is to considered deprecated, and possibly
+removed/changed in future releases.)
+
+=item *
+
+chomp() and chop() have been demoted back to I<not> being overridable
+because they cannot really be overridden-- the problem is that their
+prototype cannot be expressed and therefore one really cannot write
+replacements to override these builtins.
+
+=item *
+
 END blocks are now run even if you exit/die in a BEGIN block.
 Internally, the execution of END blocks is now controlled by 
 PL_exit_flags & PERL_EXIT_DESTRUCT_END. This enables the new
@@ -385,6 +432,11 @@ However, the lvalue subroutine feature still remains experimental.
 
 =item *
 
+A lost warning "Can't declare ... dereference in my" has been
+restored (Perl had it earlier but it became lost in later releases.)
+
+=item *
+
 A new special regular expression variable has been introduced:
 C<$^N>, which contains the most-recently closed group (submatch).
 
@@ -404,6 +456,17 @@ pop(), push(), shift(), splice(), unshift().
 
 =item *
 
+C<pack() / unpack()> now can group template letters with C<()> and then
+apply repetition/count modifiers on the groups.
+
+=item *
+
+C<pack() / unpack()> can now process the Perl internal numeric types:
+IVs, UVs, NVs-- and also long doubles, if supported by the platform.
+The template letters are C<j>, C<J>, C<F>, and C<D>.
+
+=item *
+
 C<pack('U0a*', ...)> can now be used to force a string to UTF8.
 
 =item *
@@ -432,6 +495,28 @@ prototype(\[$@%&]) is now available to implicitly create references
 
 =item *
 
+A new command-line option, C<-t> is available.  It is the
+little brother of C<-T>: instead of dieing on taint violations,
+lexical warnings are given.  B<This is only meant as a temporary
+debugging aid while securing the code of old legacy applications.
+This is not a substitute for -T.>
+
+=item *
+
+In other taint news, the C<exec LIST> and C<system LIST> have now been
+considered too risky (think C<exec @ARGV>: it can start any program
+with any arguments), and now the said forms cause a warning.
+You should carefully launder the arguments to guarantee their
+validity.  In future releases of Perl the forms will become fatal
+errors so consider starting laundering now.
+
+=item *
+
+If tr/// is just counting characters, it doesn't attempt to
+modify its target.
+
+=item *
+
 untie() will now call an UNTIE() hook if it exists.  See L<perltie>
 for details.
 
@@ -456,6 +541,22 @@ simply B<between digits>.
 
 =item *
 
+C<Attribute::Handlers> allows a class to define attribute handlers.
+
+    package MyPack;
+    use Attribute::Handlers;
+    sub Wolf :ATTR(SCALAR) { print "howl!\n" }
+
+    # later, in some package using or inheriting from MyPack...
+
+    my MyPack $Fluffy : Wolf; # the attribute handler Wolf will be called
+
+Both variables and routines can have attribute handlers.  Handlers can
+be specific to type (SCALAR, ARRAY, HASH, or CODE), or specific to the
+exact compilation phase (BEGIN, CHECK, INIT, or END).
+
+=item *
+
 B<B::Concise> is a new compiler backend for walking the Perl syntax
 tree, printing concise info about ops, from Stephen McCamant.  The
 output is highly customisable.  See L<B::Concise>.
@@ -475,7 +576,7 @@ but if not possible, the familiar Perl implementation is used.
 
 C<Devel::PPPort>, originally from Kenneth Albanowski and now
 maintained by Paul Marquess, has been added.  It is primarily used
-by C<h2xs> to enhance portability of of XS modules between different
+by C<h2xs> to enhance portability of XS modules between different
 versions of Perl.
 
 =item *
@@ -566,6 +667,11 @@ frontend Filter::Simple is to be preferred.  See L<Filter::Util::Call>.
 
 =item *
 
+C<if> is a new pragma for conditional inclusion of modules, from
+Ilya Zakharevich.
+
+=item *
+
 L<libnet> is a collection of perl5 modules related to network
 programming, from Graham Barr.  See L<Net::FTP>, L<Net::NNTP>,
 L<Net::Ping>, L<Net::POP3>, L<Net::SMTP>, and L<Net::Time>.
@@ -766,6 +872,15 @@ where data sharing was implicit.  See L<threads::shared>.
 
 =item *
 
+C<Tie::File>, by Mark-Jason Dominus, associates a Perl array with the
+lines of a file.
+
+=item *
+
+C<Tie::Memoize>, by Ilya Zakharevich, provides on-demand loaded hashes.
+
+=item *
+
 C<Tie::RefHash::Nestable>, by Edward Avis, allows storing hash
 references (unlike the standard Tie::RefHash)  The module is contained
 within Tie::RefHash, see L<Tie::RefHash>.
@@ -852,7 +967,7 @@ other improvements.
 The English module can now be used without the infamous performance
 hit by saying
 
-       use English '-no_performance_hit';
+       use English '-no_match_vars';
 
 (Assuming, of course, that one doesn't need the troublesome variables
 C<$`>, C<$&>, or C<$'>.)  Also, introduced C<@LAST_MATCH_START> and
@@ -923,6 +1038,11 @@ with 'no lib' now works.
 
 =item *
 
+ExtUtils::MakeMaker now uses File::Spec internally, which hopefully
+leads into better portability.
+
+=item *
+
 Math::BigFloat and Math::BigInt have undergone a full rewrite.
 They are now magnitudes faster, and they support various
 bignum libraries such as GMP and PARI as their backends.
@@ -933,9 +1053,10 @@ Math::Complex handles inf, NaN etc., better.
 
 =item *
 
-Net::Ping has been enhanced.  There is now "external" protocol which
-uses Net::Ping::External module which runs external ping(1) and parses
-the output.  A version of Net::Ping::External is available in CPAN.
+Net::Ping has been muchly enhanced.  Multihoming is now supported.
+There is now "external" protocol which uses Net::Ping::External module
+which runs external ping(1) and parses the output.  A version of
+Net::Ping::External is available in CPAN.
 
 =item *
 
@@ -974,7 +1095,7 @@ The vars pragma now supports declaring fully qualified variables.
 
 =item *
 
-The utf8:: name space (as in the pragma) provides various
+The C<utf8::> name space (as in the pragma) provides various
 Perl-callable functions to provide low level access to Perl's
 internal Unicode representation.  At the moment only length()
 has been implemented.
@@ -1133,8 +1254,9 @@ with perltoot in filesystems restricted to "8.3" names)
 
 =item *
 
-perluniintro is an introduction to using Unicode in Perl
-(perlunicode is more of a reference)
+perluniintro is an introduction to using Unicode in Perl.
+(perlunicode is more of a detailed reference and background
+information)
 
 =item *
 
@@ -1479,6 +1601,10 @@ AtheOS (http://www.atheos.cx/) is a new platform.
 
 =item *
 
+BeOS has been reclaimed.
+
+=item *
+
 DG/UX platform now supports the 5.005-style threads.  See L<perldgux>.
 
 =item *
@@ -1516,6 +1642,11 @@ NCR MP-RAS is now supported.
 
 =item *
 
+All the NetBSD specific patches (except for the installation
+specific ones) have been merged back to the main distribution.
+
+=item *
+
 NetWare from Novell is now supported.  See L<perlnetware>.
 
 =item *
@@ -1528,6 +1659,18 @@ NEC SUPER-UX is now supported.
 
 =item *
 
+All the OpenBSD specific patches (except for the installation
+specific ones) have been merged back to the main distribution.
+
+=item *
+
+Perl has been tested with the GNU pth userlevel thread package
+( http://www.gnu.org/software/pth/pth.html ) . All but one thread
+test worked, and that one failure was because of test results arriving
+in unexpected order.
+
+=item *
+
 Amdahl UTS UNIX mainframe platform is now supported.
 
 =item *
@@ -1841,7 +1984,14 @@ The character tables have been updated to Unicode 3.1.1.
 =item *
 
 Comparing with utf8 data does not magically upgrade non-utf8 data
-into utf8.
+into utf8.  (This was a problem for example if you were mixing data
+from I/O and Unicode data: your output might have got magically encoded
+as UTF-8.)
+
+=item *
+
+Generating illegal Unicode code points like U+FFFE, or the UTF-16
+surrogates, now also generates an optional warning.
 
 =item *
 
@@ -2155,6 +2305,14 @@ respectively.
 
 =item *
 
+perl5db.pl has been modified to present a more consistent commands
+interface, via (CommandSet=580).  perl5db.t was also added to test the
+changes, and as a placeholder for further tests.
+
+See L<perldebug>
+
+=item *
+
 If an attempt to use a (non-blessed) reference as an array index
 is made, a warning is given.
 
@@ -2461,6 +2619,13 @@ These tests fail because of yet unresolved floating point inaccuracies.
 
 =back
 
+=head2 UNICOS and UNICOS/mk
+
+The io/fs test #31 is failing because in UNICOS and UNICOS/mk
+truncate() cannot be used to grow the size of filehandles, only
+to reduce the size.  The workaround is to truncate files instead
+of filehandles.
+
 =head2 UTS
 
 There are a few known test failures, see L<perluts>.
@@ -2468,9 +2633,9 @@ There are a few known test failures, see L<perluts>.
 =head2 VMS
 
 There is one known test failure with a default configuration:
+
   [.run]switches..........................FAILED on test 1
-  
+
 =head2 Win32
 
 In multi-CPU boxes there are some problems with the I/O buffering:
@@ -2530,7 +2695,7 @@ pP are testing for Unicode code points, not knowing about EBCDIC.
 The compiler suite is slowly getting better but it continues to be
 highly experimental.  Use in production environments is discouraged.
 
-=head2 The Long Double Support is Still Experimental
+=head2 The Long Double Support Is Still Experimental
 
 The ability to configure Perl's numbers to use "long doubles",
 floating point numbers of hopefully better accuracy, is still
@@ -2542,12 +2707,19 @@ by slowdown in computations (more bits to move around, and the
 operations are more likely to be executed by less optimised
 libraries).
 
+=head2 Seen In Perl 5.7 But Gone Now
+
+C<Time::Piece> (previously known as C<Time::Object>) was removed
+because it was felt that it didn't have enough value in it to be a
+core module.  It is still a useful module, though, and is available
+from the CPAN.
+
 =head1 Reporting Bugs
 
 If you find what you think is a bug, you might check the articles
 recently posted to the comp.lang.perl.misc newsgroup and the perl
 bug database at http://bugs.perl.org.  There may also be
-information at http://www.perl.com/perl/, the Perl Home Page.
+information at http://www.perl.com/, the Perl Home Page.
 
 If you believe you have an unreported bug, please run the B<perlbug>
 program included with your release.  Be sure to trim your bug down