Perl Brasil

Pesquisar

Documentação

Artigos

Planeta

Eventos

Comunidade

r1 - 04 Mar 2006 - NelsonFerraz


NAME

perl58delta - what is new for perl v5.8.0

voltar para o topo


DESCRIPTION

This document describes differences between the 5.6.0 release and the 5.8.0 release. Many of the bug fixes in 5.8.0 were already seen in the 5.6.1 maintenance release since the two releases were kept closely coordinated (while 5.8.0 was still called 5.7.something). Changes that were integrated into the 5.6.1 release are marked [561]. Many of these changes have been further developed since 5.6.1 was released, those are marked [561+]. You can see the list of changes in the 5.6.1 release (both from the 5.005_03 release and the 5.6.0 release) by reading the perl561delta manpage.

voltar para o topo


Highlights In 5.8.0

voltar para o topo


Incompatible Changes

Binary Incompatibility

Perl 5.8 is not binary compatible with earlier releases of Perl. You have to recompile your XS modules. (Pure Perl modules should continue to work.) The major reason for the discontinuity is the new IO architecture called PerlIO? . PerlIO? is the default configuration because without it many new features of Perl 5.8 cannot be used. In other words: you just have to recompile your modules containing XS code, sorry about that. In future releases of Perl, non-PerlIO aware XS modules may become completely unsupported. This shouldn't be too difficult for module authors, however: PerlIO? has been designed as a drop-in replacement (at the source code level) for the stdio interface. Depending on your platform, there are also other reasons why we decided to break binary compatibility, please read on.

64-bit platforms and malloc

If your pointers are 64 bits wide, the Perl malloc is no longer being used because it does not work well with 8-byte pointers. Also, usually the system mallocs on such platforms are much better optimized for such large memory models than the Perl malloc. Some memory-hungry Perl applications like the PDL don't work well with Perl's malloc. Finally, other applications than Perl (such as mod_perl) tend to prefer the system malloc. Such platforms include Alpha and 64-bit HPPA, MIPS, PPC, and Sparc.

AIX Dynaloading

The AIX dynaloading now uses in AIX releases 4.3 and newer the native dlopen interface of AIX instead of the old emulated interface. This change will probably break backward compatibility with compiled modules. The change was made to make Perl more compliant with other applications like mod_perl which are using the AIX native interface.

Attributes for my variables now handled at run-time

The my EXPR : ATTRS syntax now applies variable attributes at run-time. (Subroutine and our variables still get attributes applied at compile-time.) See the attributes manpage for additional details. In particular, however, this allows variable attributes to be useful for tie interfaces, 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).

Socket Extension Dynamic in VMS

The Socket extension is now dynamically loaded instead of being statically built in. This may or may not be a problem with ancient TCP/IP stacks of VMS: we do not know since we weren't able to test Perl in such configurations.

IEEE-format Floating Point Default on OpenVMS? Alpha

Perl now uses IEEE format (T_FLOAT) as the default internal floating 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.

New Unicode Semantics (no more use utf8, almost)

Previously in Perl 5.6 to use Unicode one would say ``use utf8'' and then the operations (like string concatenation) were Unicode-aware in that lexical scope. This was found to be an inconvenient interface, and in Perl 5.8 the Unicode model has completely changed: now the ``Unicodeness'' is bound to the data itself, and for most of the time ``use utf8'' is not needed at all. The only remaining use of ``use utf8'' is when the Perl script itself has been written in the UTF-8 encoding of Unicode. (UTF-8 has not been made the default since there are many Perl scripts out there that are using various national eight-bit character sets, which would be illegal in UTF-8.) See the perluniintro manpage for the explanation of the current model, and the utf8 manpage for the current use of the utf8 pragma.

New Unicode Properties

Unicode scripts are now supported. Scripts are similar to (and superior to) Unicode 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 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 Latin). A number of other properties are now supported, including \p{L&}, \p{Any} \p{Assigned}, \p{Unassigned}, \p{Blank} [561] and \p{SpacePerl} [561] (along with their \P{...} versions, of course). See the perlunicode manpage for details, and more additions. The In or Is prefix to names used with the \p{...} and \P{...} are now almost always optional. The only exception is that a In prefix is required to signify a Unicode block when a block name conflicts with a script name. For example, \p{Tibetan} refers to the script, while \p{InTibetan} refers to the block. When there is no name conflict, you can omit the In from the block name (e.g. \p{BraillePatterns}), but to be safe, it's probably best to always use the In).

REF(...) Instead Of SCALAR(...)

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().

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 d/f, but you never knew that.)

glob() now returns filenames in alphabetical order

The list of filenames from glob() (or <...>) is now by default sorted alphabetically to be csh-compliant (which is what happened before in most UNIX platforms). (bsd_glob() does still sort platform natively, ASCII or EBCDIC, unless GLOB_ALPHASORT is specified.) [561]

Deprecations

voltar para o topo


Core Enhancements

Unicode Overhaul

Unicode in general should be now much more usable than in Perl 5.6.0 (or even in 5.6.1). Unicode can be used in hash keys, Unicode in regular expressions should work now, Unicode in tr/// should work now, Unicode in I/O should work now. See the perluniintro manpage for introduction and the perlunicode manpage for details.

PerlIO is Now The Default

ithreads

The new interpreter threads (``ithreads'' for short) implementation of multithreading, by Arthur Bergman, replaces the old ``5.005 threads'' implementation. In the ithreads model any data sharing between threads must be explicit, as opposed to the model where data sharing was implicit. See the threads manpage and the threads::shared manpage, and the perlthrtut manpage. As a part of the ithreads implementation Perl will also use any necessary and detectable reentrant libc interfaces.

Restricted Hashes

A restricted hash is restricted to a certain set of keys, no keys outside the set can be added. Also individual keys can be restricted so that the key cannot be deleted and the value cannot be changed. No new syntax is involved: the Hash::Util module is the interface.

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 (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. Note that breaking out from potentially blocking operations should still work, though.

Understanding of Numbers

In general a lot of fixing has happened in the area of Perl's understanding of numbers, both integer and floating point. Since in many systems the standard number parsing functions like strtoul() and atof() seem to have bugs, Perl tries to work around their deficiencies. This results hopefully in more accurate numbers. Perl now tries internally to use integer values in numeric conversions and basic arithmetics (+ - * /) if the arguments are integers, and tries also to keep the results stored internally as integers. This change leads to often slightly faster and always less lossy arithmetics. (Previously Perl always preferred floating point numbers in its math.)

Arrays now always interpolate into double-quoted strings [561]

In double-quoted strings, arrays now interpolate, no matter what. The behavior in earlier versions of perl 5 was that arrays would interpolate into strings if the array had been mentioned before the string was compiled, and otherwise Perl would raise a fatal compile-time error. In versions 5.000 through 5.003, the error was
        Literal @example now requires backslash
In versions 5.004_01 through 5.6.0, the error was
        In string, @example now must be written as \@example
The idea here was to get people into the habit of writing "fred\@example.com" when they wanted a literal @ sign, just as they have always written "Give me back my \$5" when they wanted a literal $ sign. Starting with 5.6.1, when Perl now sees an @ sign in a double-quoted string, it always attempts to interpolate an array, regardless of whether or not the array has been used or declared already. The fatal error has been downgraded to an optional warning:
        Possible unintended interpolation of @example in string
This warns you that "fred@example.com" is going to turn into fred.com if you don't backslash the @. See http://www.plover.com/~mjd/perl/at-error.html for more details about the history here.

Miscellaneous Changes

voltar para o topo


Modules and Pragmata

New Modules and Pragmata

Updated And Improved Modules and Pragmata

voltar para o topo


Utility Changes

voltar para o topo


New Documentation

The following platform-specific documents are available before the installation as README.platform, and after the installation as perlplatform:
    perlaix perlamiga perlapollo perlbeos perlbs2000
    perlce perlcygwin perldgux perldos perlepoc perlfreebsd perlhpux
    perlhurd perlirix perlmachten perlmacos perlmint perlmpeix
    perlnetware perlos2 perlos390 perlplan9 perlqnx perlsolaris
    perltru64 perluts perlvmesa perlvms perlvos perlwin32
These documents usually detail one or more of the following subjects: configuring, building, testing, installing, and sometimes also using Perl on the said platform. Eastern Asian Perl users are now welcomed in their own languages: README.jp (Japanese), README.ko (Korean), README.cn (simplified Chinese) and README.tw (traditional Chinese), which are written in normal pod but encoded in EUC-JP, EUC-KR, EUC-CN and Big5. These will get installed as
   perljp perlko perlcn perltw

voltar para o topo


Performance Enhancements

voltar para o topo


Installation and Configuration Improvements

Generic Improvements

New Or Improved Platforms

For the list of platforms known to support Perl, see Supported Platforms in the perlport manpage.

voltar para o topo


Selected Bug Fixes

Numerous memory leaks and uninitialized memory accesses have been hunted down. Most importantly, anonymous subs used to leak quite a bit. [561]

Platform Specific Changes and Fixes