=head1 NAME
perl581delta - what is new for perl v5.8.1
=head1 DESCRIPTION
This document describes differences between the 5.8.0 release and
the 5.8.1 release.
If you are upgrading from an earlier release such as 5.6.1, first read
the L, which describes differences between 5.6.0 and
5.8.0.
In case you are wondering about 5.6.1, it was bug-fix-wise rather
identical to the development release 5.7.1. Confused? This timeline
hopefully helps a bit: it lists the new major releases, their maintenance
releases, and the development releases.
New Maintenance Development
5.6.0 2000-Mar-22
5.7.0 2000-Sep-02
5.6.1 2001-Apr-08
5.7.1 2001-Apr-09
5.7.2 2001-Jul-13
5.7.3 2002-Mar-05
5.8.0 2002-Jul-18
5.8.1 2003-Sep-25
=head1 Incompatible Changes
=head2 Hash Randomisation
Mainly due to security reasons, the "random ordering" of hashes
has been made even more random. Previously while the order of hash
elements from keys(), values(), and each() was essentially random,
it was still repeatable. Now, however, the order varies between
different runs of Perl.
B, and the
ordering has already changed several times during the lifetime of
Perl 5. Also, the ordering of hash keys has always been, and
continues to be, affected by the insertion order.
The added randomness may affect applications.
One possible scenario is when output of an application has included
hash data. For example, if you have used the Data::Dumper module to
dump data into different files, and then compared the files to see
whether the data has changed, now you will have false positives since
the order in which hashes are dumped will vary. In general the cure
is to sort the keys (or the values); in particular for Data::Dumper to
use the C option. If some particular order is really
important, use tied hashes: for example the Tie::IxHash module
which by default preserves the order in which the hash elements
were added.
More subtle problem is reliance on the order of "global destruction".
That is what happens at the end of execution: Perl destroys all data
structures, including user data. If your destructors (the DESTROY
subroutines) have assumed any particular ordering to the global
destruction, there might be problems ahead. For example, in a
destructor of one object you cannot assume that objects of any other
class are still available, unless you hold a reference to them.
If the environment variable PERL_DESTRUCT_LEVEL is set to a non-zero
value, or if Perl is exiting a spawned thread, it will also destruct
the ordinary references and the symbol tables that are no longer in use.
You can't call a class method or an ordinary function on a class that
has been collected that way.
The hash randomisation is certain to reveal hidden assumptions about
some particular ordering of hash elements, and outright bugs: it
revealed a few bugs in the Perl core and core modules.
To disable the hash randomisation in runtime, set the environment
variable PERL_HASH_SEED to 0 (zero) before running Perl (for more
information see L), or to disable the feature
completely in compile time, compile with C<-DNO_HASH_SEED> (see F).
See L for the original
rationale behind this change.
=head2 UTF-8 On Filehandles No Longer Activated By Locale
In Perl 5.8.0 all filehandles, including the standard filehandles,
were implicitly set to be in Unicode UTF-8 if the locale settings
indicated the use of UTF-8. This feature caused too many problems,
so the feature was turned off and redesigned: see L"Core Enhancements">.
=head2 Single-number v-strings are no longer v-strings before "=>"
The version strings or v-strings (see L)
feature introduced in Perl 5.6.0 has been a source of some confusion--
especially when the user did not want to use it, but Perl thought it
knew better. Especially troublesome has been the feature that before
a "=>" a version string (a "v" followed by digits) has been interpreted
as a v-string instead of a string literal. In other words:
%h = ( v65 => 42 );
has meant since Perl 5.6.0
%h = ( 'A' => 42 );
(at least in platforms of ASCII progeny) Perl 5.8.1 restores the
more natural interpretation
%h = ( 'v65' => 42 );
The multi-number v-strings like v65.66 and 65.66.67 still continue to
be v-strings in Perl 5.8.
=head2 (Win32) The -C Switch Has Been Repurposed
The -C switch has changed in an incompatible way. The old semantics
of this switch only made sense in Win32 and only in the "use utf8"
universe in 5.6.x releases, and do not make sense for the Unicode
implementation in 5.8.0. Since this switch could not have been used
by anyone, it has been repurposed. The behavior that this switch
enabled in 5.6.x releases may be supported in a transparent,
data-dependent fashion in a future release.
For the new life of this switch, see L<"UTF-8 no longer default under
UTF-8 locales">, and L.
=head2 (Win32) The /d Switch Of cmd.exe
Perl 5.8.1 uses the /d switch when running the cmd.exe shell
internally for system(), backticks, and when opening pipes to external
programs. The extra switch disables the execution of AutoRun commands
from the registry, which is generally considered undesirable when
running external programs. If you wish to retain compatibility with
the older behavior, set PERL5SHELL in your environment to C.
=head1 Core Enhancements
=head2 UTF-8 no longer default under UTF-8 locales
In Perl 5.8.0 many Unicode features were introduced. One of them
was found to be of more nuisance than benefit: the automagic
(and silent) "UTF-8-ification" of filehandles, including the
standard filehandles, if the user's locale settings indicated
use of UTF-8.
For example, if you had C as your locale, your STDIN and
STDOUT were automatically "UTF-8", in other words an implicit
binmode(..., ":utf8") was made. This meant that trying to print, say,
chr(0xff), ended up printing the bytes 0xc3 0xbf. Hardly what
you had in mind unless you were aware of this feature of Perl 5.8.0.
The problem is that the vast majority of people weren't: for example
in RedHat releases 8 and 9 the B locale setting is UTF-8, so
all RedHat users got UTF-8 filehandles, whether they wanted it or not.
The pain was intensified by the Unicode implementation of Perl 5.8.0
(still) having nasty bugs, especially related to the use of s/// and
tr///. (Bugs that have been fixed in 5.8.1)
Therefore a decision was made to backtrack the feature and change it
from implicit silent default to explicit conscious option. The new
Perl command line option C<-C> and its counterpart environment
variable PERL_UNICODE can now be used to control how Perl and Unicode
interact at interfaces like I/O and for example the command line
arguments. See L and L for more
information.
=head2 Unsafe signals again available
In Perl 5.8.0 the so-called "safe signals" were introduced. This
means that Perl no longer handles signals immediately but instead
"between opcodes", when it is safe to do so. The earlier immediate
handling easily could corrupt the internal state of Perl, resulting
in mysterious crashes.
However, the new safer model has its problems too. Because now an
opcode, a basic unit of Perl execution, is never interrupted but
instead let to run to completion, certain operations that can take a
long time now really do take a long time. For example, certain
network operations have their own blocking and timeout mechanisms, and
being able to interrupt them immediately would be nice.
Therefore perl 5.8.1 introduces a "backdoor" to restore the pre-5.8.0
(pre-5.7.3, really) signal behaviour. Just set the environment variable
PERL_SIGNALS to C, and the old immediate (and unsafe)
signal handling behaviour returns. See L
and L.
In completely unrelated news, you can now use safe signals with
POSIX::SigAction. See L.
=head2 Tied Arrays with Negative Array Indices
Formerly, the indices passed to C, C, C, and
C methods in tied array class were always non-negative. If
the actual argument was negative, Perl would call FETCHSIZE implicitly
and add the result to the index before passing the result to the tied
array method. This behaviour is now optional. If the tied array class
contains a package variable named C<$NEGATIVE_INDICES> which is set to
a true value, negative values will be passed to C, C,
C, and C unchanged.
=head2 local ${$x}
The syntaxes
local ${$x}
local @{$x}
local %{$x}
now do localise variables, given that the $x is a valid variable name.
=head2 Unicode Character Database 4.0.0
The copy of the Unicode Character Database included in Perl 5.8 has
been updated to 4.0.0 from 3.2.0. This means for example that the
Unicode character properties are as in Unicode 4.0.0.
=head2 Deprecation Warnings
There is one new feature deprecation. Perl 5.8.0 forgot to add
some deprecation warnings, these warnings have now been added.
Finally, a reminder of an impending feature removal.
=head3 (Reminder) Pseudo-hashes are deprecated (really)
Pseudo-hashes were deprecated in Perl 5.8.0 and will be removed in
Perl 5.10.0, see L for details. Each attempt to access
pseudo-hashes will trigger the warning C.
If you really want to continue using pseudo-hashes but not to see the
deprecation warnings, use:
no warnings 'deprecated';
Or you can continue to use the L pragma, but please don't
expect the data structures to be pseudohashes any more.
=head3 (Reminder) 5.005-style threads are deprecated (really)
5.005-style threads (activated by C