perl5005delta.html

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

HTML
1,169
字号
<?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>perl5005delta - what's new for perl5.005</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>perl5005delta - what's new for perl5.005</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="#about_the_new_versioning_system">About the new versioning system</a></li>
	<li><a href="#incompatible_changes">Incompatible Changes</a></li>
	<ul>

		<li><a href="#warning__this_version_is_not_binary_compatible_with_perl_5_004_">WARNING:  This version is not binary compatible with Perl 5.004.</a></li>
		<li><a href="#default_installation_structure_has_changed">Default installation structure has changed</a></li>
		<li><a href="#perl_source_compatibility">Perl Source Compatibility</a></li>
		<li><a href="#c_source_compatibility">C Source Compatibility</a></li>
		<li><a href="#binary_compatibility">Binary Compatibility</a></li>
		<li><a href="#security_fixes_may_affect_compatibility">Security fixes may affect compatibility</a></li>
		<li><a href="#relaxed_new_mandatory_warnings_introduced_in_5_004">Relaxed new mandatory warnings introduced in 5.004</a></li>
		<li><a href="#licensing">Licensing</a></li>
	</ul>

	<li><a href="#core_changes">Core Changes</a></li>
	<ul>

		<li><a href="#threads">Threads</a></li>
		<li><a href="#compiler">Compiler</a></li>
		<li><a href="#regular_expressions">Regular Expressions</a></li>
		<li><a href="#improved_malloc__">Improved <code>malloc()</code></a></li>
		<li><a href="#quicksort_is_internally_implemented">Quicksort is internally implemented</a></li>
		<li><a href="#reliable_signals">Reliable signals</a></li>
		<li><a href="#reliable_stack_pointers">Reliable stack pointers</a></li>
		<li><a href="#more_generous_treatment_of_carriage_returns">More generous treatment of carriage returns</a></li>
		<li><a href="#memory_leaks">Memory leaks</a></li>
		<li><a href="#better_support_for_multiple_interpreters">Better support for multiple interpreters</a></li>
		<li><a href="#behavior_of_local___on_array_and_hash_elements_is_now_welldefined">Behavior of <a href="../../lib/Pod/perlfunc.html#item_local"><code>local()</code></a> on array and hash elements is now well-defined</a></li>
		<li><a href="#___is_transparently_tied_to_the_errno_module"><a href="../../lib/Pod/perlvar.html#item___"><code>%!</code></a> is transparently tied to the <a href="../../lib/Errno.html">the Errno manpage</a> module</a></li>
		<li><a href="#pseudohashes_are_supported">Pseudo-hashes are supported</a></li>
		<li><a href="#expr_foreach_expr_is_supported"><code>EXPR foreach EXPR</code> is supported</a></li>
		<li><a href="#keywords_can_be_globally_overridden">Keywords can be globally overridden</a></li>
		<li><a href="#__e_is_meaningful_on_win32"><a href="../../lib/Pod/perlvar.html#item___e"><code>$^E</code></a> is meaningful on Win32</a></li>
		<li><a href="#foreach__1__1000000__optimized"><code>foreach (1..1000000)</code> optimized</a></li>
		<li><a href="#foo___can_be_used_as_implicitly_quoted_package_name"><code>Foo::</code> can be used as implicitly quoted package name</a></li>
		<li><a href="#exists__foo___bar____tests_existence_of_a_package"><code>exists $Foo::{Bar::}</code> tests existence of a package</a></li>
		<li><a href="#better_locale_support">Better locale support</a></li>
		<li><a href="#experimental_support_for_64bit_platforms">Experimental support for 64-bit platforms</a></li>
		<li><a href="#prototype___returns_useful_results_on_builtins"><a href="../../lib/Pod/perlfunc.html#item_prototype"><code>prototype()</code></a> returns useful results on builtins</a></li>
		<li><a href="#extended_support_for_exception_handling">Extended support for exception handling</a></li>
		<li><a href="#reblessing_in_destroy___supported_for_chaining_destroy___methods">Re-blessing in <code>DESTROY()</code> supported for chaining <code>DESTROY()</code> methods</a></li>
		<li><a href="#all_printf_format_conversions_are_handled_internally">All <a href="../../lib/Pod/perlfunc.html#item_printf"><code>printf</code></a> format conversions are handled internally</a></li>
		<li><a href="#new_init_keyword">New <code>INIT</code> keyword</a></li>
		<li><a href="#new_lock_keyword">New <a href="../../lib/Pod/perlfunc.html#item_lock"><code>lock</code></a> keyword</a></li>
		<li><a href="#new_qr___operator">New <a href="../../lib/Pod/perlfunc.html#item_qr_"><code>qr//</code></a> operator</a></li>
		<li><a href="#our_is_now_a_reserved_word"><a href="../../lib/Pod/perlfunc.html#item_our"><code>our</code></a> is now a reserved word</a></li>
		<li><a href="#tied_arrays_are_now_fully_supported">Tied arrays are now fully supported</a></li>
		<li><a href="#tied_handles_support_is_better">Tied handles support is better</a></li>
		<li><a href="#4th_argument_to_substr">4th argument to substr</a></li>
		<li><a href="#negative_length_argument_to_splice">Negative LENGTH argument to splice</a></li>
		<li><a href="#magic_lvalues_are_now_more_magical">Magic lvalues are now more magical</a></li>
		<li><a href="#___now_reads_in_records">&lt;&gt; now reads in records</a></li>
	</ul>

	<li><a href="#supported_platforms">Supported Platforms</a></li>
	<ul>

		<li><a href="#new_platforms">New Platforms</a></li>
		<li><a href="#changes_in_existing_support">Changes in existing support</a></li>
	</ul>

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

		<li><a href="#new_modules">New Modules</a></li>
		<li><a href="#changes_in_existing_modules">Changes in existing modules</a></li>
	</ul>

	<li><a href="#utility_changes">Utility Changes</a></li>
	<li><a href="#documentation_changes">Documentation Changes</a></li>
	<li><a href="#new_diagnostics">New Diagnostics</a></li>
	<li><a href="#obsolete_diagnostics">Obsolete Diagnostics</a></li>
	<li><a href="#configuration_changes">Configuration Changes</a></li>
	<li><a href="#bugs">BUGS</a></li>
	<li><a href="#see_also">SEE ALSO</a></li>
	<li><a href="#history">HISTORY</a></li>
</ul>
<!-- INDEX END -->

<hr />
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>perl5005delta - what's new for perl5.005</p>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>This document describes differences between the 5.004 release and this one.</p>
<p>
</p>
<hr />
<h1><a name="about_the_new_versioning_system">About the new versioning system</a></h1>
<p>Perl is now developed on two tracks: a maintenance track that makes
small, safe updates to released production versions with emphasis on
compatibility; and a development track that pursues more aggressive
evolution.  Maintenance releases (which should be considered production
quality) have subversion numbers that run from <code>1</code> to <code>49</code>, and
development releases (which should be considered &quot;alpha&quot; quality) run
from <code>50</code> to <code>99</code>.</p>
<p>Perl 5.005 is the combined product of the new dual-track development
scheme.</p>
<p>
</p>
<hr />
<h1><a name="incompatible_changes">Incompatible Changes</a></h1>
<p>
</p>
<h2><a name="warning__this_version_is_not_binary_compatible_with_perl_5_004_">WARNING:  This version is not binary compatible with Perl 5.004.</a></h2>
<p>Starting with Perl 5.004_50 there were many deep and far-reaching changes
to the language internals.  If you have dynamically loaded extensions
that you built under perl 5.003 or 5.004, you can continue to use them
with 5.004, but you will need to rebuild and reinstall those extensions
to use them 5.005.  See <em>INSTALL</em> for detailed instructions on how to
upgrade.</p>
<p>
</p>
<h2><a name="default_installation_structure_has_changed">Default installation structure has changed</a></h2>
<p>The new Configure defaults are designed to allow a smooth upgrade from
5.004 to 5.005, but you should read <em>INSTALL</em> for a detailed
discussion of the changes in order to adapt them to your system.</p>
<p>
</p>
<h2><a name="perl_source_compatibility">Perl Source Compatibility</a></h2>
<p>When none of the experimental features are enabled, there should be
very few user-visible Perl source compatibility issues.</p>
<p>If threads are enabled, then some caveats apply. <a href="../../lib/Pod/perlvar.html#item___"><code>@_</code></a> and <a href="../../lib/Pod/perlvar.html#item___"><code>$_</code></a> become
lexical variables.  The effect of this should be largely transparent to
the user, but there are some boundary conditions under which user will
need to be aware of the issues.  For example, <a href="../../lib/Pod/perlfunc.html#item_local"><code>local(@_)</code></a> results in
a &quot;Can't localize lexical variable @_ ...&quot; message.  This may be enabled
in a future version.</p>
<p>Some new keywords have been introduced.  These are generally expected to
have very little impact on compatibility.  See <a href="#new_c_init__keyword">New <code>INIT</code> keyword</a>,
<a href="#new_c_lock__keyword">New <a href="../../lib/Pod/perlfunc.html#item_lock"><code>lock</code></a> keyword</a>, and <a href="#new_c_qre_sol_e_sol___operator">New <a href="../../lib/Pod/perlfunc.html#item_qr_"><code>qr//</code></a> operator</a>.</p>
<p>Certain barewords are now reserved.  Use of these will provoke a warning
if you have asked for them with the <a href="../../lib/Pod/perlrun.html#item__2dw"><code>-w</code></a> switch.
See <a href="#c_our__is_now_a_reserved_word"><a href="../../lib/Pod/perlfunc.html#item_our"><code>our</code></a> is now a reserved word</a>.</p>
<p>
</p>
<h2><a name="c_source_compatibility">C Source Compatibility</a></h2>
<p>There have been a large number of changes in the internals to support
the new features in this release.</p>
<ul>
<li>
<p>Core sources now require ANSI C compiler</p>
<p>An ANSI C compiler is now <strong>required</strong> to build perl.  See <em>INSTALL</em>.</p>
</li>
<li>
<p>All Perl global variables must now be referenced with an explicit prefix</p>
<p>All Perl global variables that are visible for use by extensions now
have a <code>PL_</code> prefix.  New extensions should <code>not</code> refer to perl globals
by their unqualified names.  To preserve sanity, we provide limited
backward compatibility for globals that are being widely used like
<code>sv_undef</code> and <code>na</code> (which should now be written as <code>PL_sv_undef</code>,
<code>PL_na</code> etc.)</p>
<p>If you find that your XS extension does not compile anymore because a
perl global is not visible, try adding a <code>PL_</code> prefix to the global
and rebuild.</p>
<p>It is strongly recommended that all functions in the Perl API that don't
begin with <code>perl</code> be referenced with a <code>Perl_</code> prefix.  The bare function
names without the <code>Perl_</code> prefix are supported with macros, but this
support may cease in a future release.</p>
<p>See <a href="../../lib/Pod/perlapi.html">the perlapi manpage</a>.</p>
</li>
<li>
<p>Enabling threads has source compatibility issues</p>
<p>Perl built with threading enabled requires extensions to use the new
<code>dTHR</code> macro to initialize the handle to access per-thread data.
If you see a compiler error that talks about the variable <code>thr</code> not
being declared (when building a module that has XS code),  you need
to add <code>dTHR;</code> at the beginning of the block that elicited the error.</p>
<p>The API function <code>perl_get_sv(&quot;@&quot;,FALSE)</code> should be used instead of
directly accessing perl globals as <code>GvSV(errgv)</code>.  The API call is
backward compatible with existing perls and provides source compatibility
with threading is enabled.</p>
<p>See <a href="#c_source_compatibility">C Source Compatibility</a> for more information.</p>
</li>
</ul>
<p>
</p>
<h2><a name="binary_compatibility">Binary Compatibility</a></h2>
<p>This version is NOT binary compatible with older versions.  All extensions
will need to be recompiled.  Further binaries built with threads enabled
are incompatible with binaries built without.  This should largely be
transparent to the user, as all binary incompatible configurations have
their own unique architecture name, and extension binaries get installed at
unique locations.  This allows coexistence of several configurations in
the same directory hierarchy.  See <em>INSTALL</em>.</p>
<p>
</p>
<h2><a name="security_fixes_may_affect_compatibility">Security fixes may affect compatibility</a></h2>
<p>A few taint leaks and taint omissions have been corrected.  This may lead
to &quot;failure&quot; of scripts that used to work with older versions.  Compiling
with -DINCOMPLETE_TAINTS provides a perl with minimal amounts of changes
to the tainting behavior.  But note that the resulting perl will have
known insecurities.</p>
<p>Oneliners with the <code>-e</code> switch do not create temporary files anymore.</p>
<p>
</p>
<h2><a name="relaxed_new_mandatory_warnings_introduced_in_5_004">Relaxed new mandatory warnings introduced in 5.004</a></h2>
<p>Many new warnings that were introduced in 5.004 have been made
optional.  Some of these warnings are still present, but perl's new
features make them less often a problem.  See <a href="#new_diagnostics">New Diagnostics</a>.</p>
<p>
</p>
<h2><a name="licensing">Licensing</a></h2>

⌨️ 快捷键说明

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