perl581delta.html

来自「perl教程」· HTML 代码 · 共 1,197 行 · 第 1/4 页

HTML
1,197
字号
<?xml version="1.0" ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<!-- saved from url=(0017)http://localhost/ -->
<script language="JavaScript" src="../../displayToc.js"></script>
<script language="JavaScript" src="../../tocParas.js"></script>
<script language="JavaScript" src="../../tocTab.js"></script>
<link rel="stylesheet" type="text/css" href="../../scineplex.css">
<title>perl581delta - what is new for perl v5.8.1</title>
<link rel="stylesheet" href="../../Active.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:" />
</head>

<body>

<script>writelinks('__top__',2);</script>
<h1><a>perl581delta - what is new for perl v5.8.1</a></h1>
<p><a name="__index__"></a></p>

<!-- INDEX BEGIN -->

<ul>

	<li><a href="#name">NAME</a></li>
	<li><a href="#description">DESCRIPTION</a></li>
	<li><a href="#incompatible_changes">Incompatible Changes</a></li>
	<ul>

		<li><a href="#hash_randomisation">Hash Randomisation</a></li>
		<li><a href="#utf8_on_filehandles_no_longer_activated_by_locale">UTF-8 On Filehandles No Longer Activated By Locale</a></li>
		<li><a href="#singlenumber_vstrings_are_no_longer_vstrings_before___">Single-number v-strings are no longer v-strings before &quot;=&gt;&quot;</a></li>
		<li><a href="#_win32__the_c_switch_has_been_repurposed">(Win32) The -C Switch Has Been Repurposed</a></li>
		<li><a href="#_win32__the__d_switch_of_cmd_exe">(Win32) The /d Switch Of cmd.exe</a></li>
	</ul>

	<li><a href="#core_enhancements">Core Enhancements</a></li>
	<ul>

		<li><a href="#utf8_no_longer_default_under_utf8_locales">UTF-8 no longer default under UTF-8 locales</a></li>
		<li><a href="#unsafe_signals_again_available">Unsafe signals again available</a></li>
		<li><a href="#tied_arrays_with_negative_array_indices">Tied Arrays with Negative Array Indices</a></li>
		<li><a href="#local____x_">local ${$x}</a></li>
		<li><a href="#unicode_character_database_4_0_0">Unicode Character Database 4.0.0</a></li>
		<li><a href="#deprecation_warnings">Deprecation Warnings</a></li>
		<ul>

			<li><a href="#_reminder__pseudohashes_are_deprecated__really_">(Reminder) Pseudo-hashes are deprecated (really)</a></li>
			<li><a href="#_reminder__5_005style_threads_are_deprecated__really_">(Reminder) 5.005-style threads are deprecated (really)</a></li>
			<li><a href="#_reminder__the____variable_is_deprecated__really_">(Reminder) The $* variable is deprecated (really)</a></li>
		</ul>

		<li><a href="#miscellaneous_enhancements">Miscellaneous Enhancements</a></li>
	</ul>

	<li><a href="#modules_and_pragmata">Modules and Pragmata</a></li>
	<ul>

		<li><a href="#updated_modules_and_pragmata">Updated Modules And Pragmata</a></li>
	</ul>

	<li><a href="#utility_changes">Utility Changes</a></li>
	<li><a href="#new_documentation">New Documentation</a></li>
	<li><a href="#installation_and_configuration_improvements">Installation and Configuration Improvements</a></li>
	<ul>

		<li><a href="#platformspecific_enhancements">Platform-specific enhancements</a></li>
	</ul>

	<li><a href="#selected_bug_fixes">Selected Bug Fixes</a></li>
	<ul>

		<li><a href="#closures__eval_and_lexicals">Closures, eval and lexicals</a></li>
		<li><a href="#generic_fixes">Generic fixes</a></li>
		<li><a href="#platformspecific_fixes">Platform-specific fixes</a></li>
	</ul>

	<li><a href="#new_or_changed_diagnostics">New or Changed Diagnostics</a></li>
	<ul>

		<li><a href="#changed_a_thread_exited_while__d_threads_were_running">Changed &quot;A thread exited while %d threads were running&quot;</a></li>
		<li><a href="#removed_attempt_to_clear_a_restricted_hash">Removed &quot;Attempt to clear a restricted hash&quot;</a></li>
		<li><a href="#new_illegal_declaration_of_anonymous_subroutine">New &quot;Illegal declaration of anonymous subroutine&quot;</a></li>
		<li><a href="#changed_invalid_range__s_in_transliteration_operator">Changed &quot;Invalid range &quot;%s&quot; in transliteration operator&quot;</a></li>
		<li><a href="#new_missing_control_char_name_in__c">New &quot;Missing control char name in \c&quot;</a></li>
		<li><a href="#new_newline_in_leftjustified_string_for__s">New &quot;Newline in left-justified string for %s&quot;</a></li>
		<li><a href="#new_possible_precedence_problem_on_bitwise__c_operator">New &quot;Possible precedence problem on bitwise %c operator&quot;</a></li>
		<li><a href="#new_pseudohashes_are_deprecated">New &quot;Pseudo-hashes are deprecated&quot;</a></li>
		<li><a href="#new_read___on__s_filehandle__s">New &quot;read() on %s filehandle %s&quot;</a></li>
		<li><a href="#new_5_005_threads_are_deprecated">New &quot;5.005 threads are deprecated&quot;</a></li>
		<li><a href="#new_tied_variable_freed_while_still_in_use">New &quot;Tied variable freed while still in use&quot;</a></li>
		<li><a href="#new_to_s__illegal_mapping___s_">New &quot;To%s: illegal mapping '%s'&quot;</a></li>
		<li><a href="#new_use_of_freed_value_in_iteration">New &quot;Use of freed value in iteration&quot;</a></li>
	</ul>

	<li><a href="#changed_internals">Changed Internals</a></li>
	<li><a href="#new_tests">New Tests</a></li>
	<li><a href="#known_problems">Known Problems</a></li>
	<ul>

		<li><a href="#tied_hashes_in_scalar_context">Tied hashes in scalar context</a></li>
		<li><a href="#net__ping_450_service_and_510_ping_udp_failures">Net::Ping 450_service and 510_ping_udp failures</a></li>
		<li><a href="#b__c">B::C</a></li>
	</ul>

	<li><a href="#platform_specific_problems">Platform Specific Problems</a></li>
	<ul>

		<li><a href="#ebcdic_platforms">EBCDIC Platforms</a></li>
		<li><a href="#cygwin_1_5_problems">Cygwin 1.5 problems</a></li>
		<li><a href="#hpux__hp_cc_warnings_about_sendfile_and_sendpath">HP-UX: HP cc warnings about sendfile and sendpath</a></li>
		<li><a href="#irix__t_uni_tr_7jis_t_falsely_failing">IRIX: t/uni/tr_7jis.t falsely failing</a></li>
		<li><a href="#mac_os_x__no_usemymalloc">Mac OS X: no usemymalloc</a></li>
		<li><a href="#tru64__no_threaded_builds_with_gnu_cc__gcc_">Tru64: No threaded builds with GNU cc (gcc)</a></li>
		<li><a href="#win32__sysopen__sysread__syswrite">Win32: sysopen, sysread, syswrite</a></li>
	</ul>

	<li><a href="#future_directions">Future Directions</a></li>
	<li><a href="#reporting_bugs">Reporting Bugs</a></li>
	<li><a href="#see_also">SEE ALSO</a></li>
</ul>
<!-- INDEX END -->

<hr />
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>perl581delta - what is new for perl v5.8.1</p>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>This document describes differences between the 5.8.0 release and
the 5.8.1 release.</p>
<p>If you are upgrading from an earlier release such as 5.6.1, first read
the <a href="../../lib/Pod/perl58delta.html">the perl58delta manpage</a>, which describes differences between 5.6.0 and
5.8.0.</p>
<p>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.</p>
<pre>
          New     Maintenance  Development</pre>
<pre>
          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</pre>
<p>
</p>
<hr />
<h1><a name="incompatible_changes">Incompatible Changes</a></h1>
<p>
</p>
<h2><a name="hash_randomisation">Hash Randomisation</a></h2>
<p>Mainly due to security reasons, the &quot;random ordering&quot; of hashes
has been made even more random.  Previously while the order of hash
elements from keys(), values(), and <a href="../../lib/Pod/perlfunc.html#item_each"><code>each()</code></a> was essentially random,
it was still repeatable.  Now, however, the order varies between
different runs of Perl.</p>
<p><strong>Perl has never guaranteed any ordering of the hash keys</strong>, 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.</p>
<p>The added randomness may affect applications.</p>
<p>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 <code>Sortkeys</code> 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.</p>
<p>More subtle problem is reliance on the order of &quot;global destruction&quot;.
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.</p>
<p>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.</p>
<p>To disable the hash randomisation in runtime, set the environment
variable PERL_HASH_SEED to 0 (zero) before running Perl (for more
information see <a href="../../lib/Pod/perlrun.html#perl_hash_seed">PERL_HASH_SEED in the perlrun manpage</a>), or to disable the feature
completely in compile time, compile with <code>-DNO_HASH_SEED</code> (see <em>INSTALL</em>).</p>
<p>See <a href="../../lib/Pod/perlsec.html#algorithmic_complexity_attacks">Algorithmic Complexity Attacks in the perlsec manpage</a> for the original
rationale behind this change.</p>
<p>
</p>
<h2><a name="utf8_on_filehandles_no_longer_activated_by_locale">UTF-8 On Filehandles No Longer Activated By Locale</a></h2>
<p>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 <a href="#core_enhancements">Core Enhancements</a>.</p>
<p>
</p>
<h2><a name="singlenumber_vstrings_are_no_longer_vstrings_before___">Single-number v-strings are no longer v-strings before &quot;=&gt;&quot;</a></h2>
<p>The version strings or v-strings (see <a href="../../lib/Pod/perldata.html#version_strings">Version Strings in the perldata manpage</a>)
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 &quot;=&gt;&quot; a version string (a &quot;v&quot; followed by digits) has been interpreted
as a v-string instead of a string literal.  In other words:</p>
<pre>
        <span class="variable">%h</span> <span class="operator">=</span> <span class="operator">(</span> <span class="string">v65</span> <span class="operator">=&gt;</span> <span class="number">42</span> <span class="operator">);</span>
</pre>
<p>has meant since Perl 5.6.0</p>
<pre>
        <span class="variable">%h</span> <span class="operator">=</span> <span class="operator">(</span> <span class="string">'A'</span> <span class="operator">=&gt;</span> <span class="number">42</span> <span class="operator">);</span>
</pre>
<p>(at least in platforms of ASCII progeny)  Perl 5.8.1 restores the
more natural interpretation</p>
<pre>
        <span class="variable">%h</span> <span class="operator">=</span> <span class="operator">(</span> <span class="string">'v65'</span> <span class="operator">=&gt;</span> <span class="number">42</span> <span class="operator">);</span>
</pre>
<p>The multi-number v-strings like v65.66 and 65.66.67 still continue to
be v-strings in Perl 5.8.</p>
<p>
</p>
<h2><a name="_win32__the_c_switch_has_been_repurposed">(Win32) The -C Switch Has Been Repurposed</a></h2>
<p>The -C switch has changed in an incompatible way.  The old semantics
of this switch only made sense in Win32 and only in the &quot;use utf8&quot;
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.</p>
<p>For the new life of this switch, see <a href="#utf8_no_longer_default_under_utf8_locales">UTF-8 no longer default under UTF-8 locales</a>, and <a href="../../lib/Pod/perlrun.html#c">-C in the perlrun manpage</a>.</p>
<p>
</p>
<h2><a name="_win32__the__d_switch_of_cmd_exe">(Win32) The /d Switch Of cmd.exe</a></h2>
<p>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 <code>cmd /x/c</code>.</p>
<p>
</p>
<hr />
<h1><a name="core_enhancements">Core Enhancements</a></h1>
<p>
</p>
<h2><a name="utf8_no_longer_default_under_utf8_locales">UTF-8 no longer default under UTF-8 locales</a></h2>
<p>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) &quot;UTF-8-ification&quot; of filehandles, including the
standard filehandles, if the user's locale settings indicated
use of UTF-8.</p>
<p>For example, if you had <code>en_US.UTF-8</code> as your locale, your STDIN and
STDOUT were automatically &quot;UTF-8&quot;, in other words an implicit
binmode(..., &quot;:utf8&quot;) 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 <strong>default</strong> 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)</p>
<p>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 <code>-C</code> 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 <a href="../../lib/Pod/perlrun.html#c">-C in the perlrun manpage</a> and <a href="../../lib/Pod/perlrun.html#perl_unicode">PERL_UNICODE in the perlrun manpage</a> for more
information.</p>
<p>
</p>
<h2><a name="unsafe_signals_again_available">Unsafe signals again available</a></h2>
<p>In Perl 5.8.0 the so-called &quot;safe signals&quot; were introduced.  This
means that Perl no longer handles signals immediately but instead
&quot;between opcodes&quot;, when it is safe to do so.  The earlier immediate
handling easily could corrupt the internal state of Perl, resulting
in mysterious crashes.</p>
<p>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.</p>
<p>Therefore perl 5.8.1 introduces a &quot;backdoor&quot; to restore the pre-5.8.0
(pre-5.7.3, really) signal behaviour.  Just set the environment variable
PERL_SIGNALS to <code>unsafe</code>, and the old immediate (and unsafe)
signal handling behaviour returns.  See <a href="../../lib/Pod/perlrun.html#perl_signals">PERL_SIGNALS in the perlrun manpage</a>
and <a href="../../lib/Pod/perlipc.html#deferred_signals__safe_signals_">Deferred Signals (Safe Signals) in the perlipc manpage</a>.</p>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?