perl581delta.html
来自「perl教程」· HTML 代码 · 共 1,197 行 · 第 1/4 页
HTML
1,197 行
<p>In completely unrelated news, you can now use safe signals with
POSIX::SigAction. See <a href="../../lib/auto/POSIX/posix__sigaction.html">POSIX::SigAction in the POSIX manpage</a>.</p>
<p>
</p>
<h2><a name="tied_arrays_with_negative_array_indices">Tied Arrays with Negative Array Indices</a></h2>
<p>Formerly, the indices passed to <code>FETCH</code>, <code>STORE</code>, <code>EXISTS</code>, and
<code>DELETE</code> 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 <code>$NEGATIVE_INDICES</code> which is set to
a true value, negative values will be passed to <code>FETCH</code>, <code>STORE</code>,
<code>EXISTS</code>, and <code>DELETE</code> unchanged.</p>
<p>
</p>
<h2><a name="local____x_">local ${$x}</a></h2>
<p>The syntaxes</p>
<pre>
<span class="keyword">local</span> <span class="variable">$</span><span class="operator">{</span><span class="variable">$x</span><span class="operator">}</span>
<span class="keyword">local</span> <span class="variable">@</span><span class="operator">{</span><span class="variable">$x</span><span class="operator">}</span>
<span class="keyword">local</span> <span class="variable">%</span><span class="operator">{</span><span class="variable">$x</span><span class="operator">}</span>
</pre>
<p>now do localise variables, given that the $x is a valid variable name.</p>
<p>
</p>
<h2><a name="unicode_character_database_4_0_0">Unicode Character Database 4.0.0</a></h2>
<p>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.</p>
<p>
</p>
<h2><a name="deprecation_warnings">Deprecation Warnings</a></h2>
<p>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.</p>
<p>
</p>
<h3><a name="_reminder__pseudohashes_are_deprecated__really_">(Reminder) Pseudo-hashes are deprecated (really)</a></h3>
<p>Pseudo-hashes were deprecated in Perl 5.8.0 and will be removed in
Perl 5.10.0, see <a href="../../lib/Pod/perl58delta.html">the perl58delta manpage</a> for details. Each attempt to access
pseudo-hashes will trigger the warning <code>Pseudo-hashes are deprecated</code>.
If you really want to continue using pseudo-hashes but not to see the
deprecation warnings, use:</p>
<pre>
<span class="keyword">no</span> <span class="variable">warnings</span> <span class="string">'deprecated'</span><span class="operator">;</span>
</pre>
<p>Or you can continue to use the <a href="../../lib/fields.html">the fields manpage</a> pragma, but please don't
expect the data structures to be pseudohashes any more.</p>
<p>
</p>
<h3><a name="_reminder__5_005style_threads_are_deprecated__really_">(Reminder) 5.005-style threads are deprecated (really)</a></h3>
<p>5.005-style threads (activated by <code>use Thread;</code>) were deprecated in
Perl 5.8.0 and will be removed after Perl 5.8, see <a href="../../lib/Pod/perl58delta.html">the perl58delta manpage</a> for
details. Each 5.005-style thread creation will trigger the warning
<code>5.005 threads are deprecated</code>. If you really want to continue
using the 5.005 threads but not to see the deprecation warnings, use:</p>
<pre>
<span class="keyword">no</span> <span class="variable">warnings</span> <span class="string">'deprecated'</span><span class="operator">;</span>
</pre>
<p>
</p>
<h3><a name="_reminder__the____variable_is_deprecated__really_">(Reminder) The $* variable is deprecated (really)</a></h3>
<p>The <a href="../../lib/Pod/perlvar.html#item___"><code>$*</code></a> variable controlling multi-line matching has been deprecated
and will be removed after 5.8. The variable has been deprecated for a
long time, and a deprecation warning <code>Use of $* is deprecated</code> is given,
now the variable will just finally be removed. The functionality has
been supplanted by the <code>/s</code> and <code>/m</code> modifiers on pattern matching.
If you really want to continue using the <a href="../../lib/Pod/perlvar.html#item___"><code>$*</code></a>-variable but not to see
the deprecation warnings, use:</p>
<pre>
<span class="keyword">no</span> <span class="variable">warnings</span> <span class="string">'deprecated'</span><span class="operator">;</span>
</pre>
<p>
</p>
<h2><a name="miscellaneous_enhancements">Miscellaneous Enhancements</a></h2>
<p><a href="../../lib/Pod/perlfunc.html#item_map"><code>map</code></a> in void context is no longer expensive. <a href="../../lib/Pod/perlfunc.html#item_map"><code>map</code></a> is now context
aware, and will not construct a list if called in void context.</p>
<p>If a socket gets closed by the server while printing to it, the client
now gets a SIGPIPE. While this new feature was not planned, it fell
naturally out of PerlIO changes, and is to be considered an accidental
feature.</p>
<p>PerlIO::get_layers(FH) returns the names of the PerlIO layers
active on a filehandle.</p>
<p>PerlIO::via layers can now have an optional UTF8 method to
indicate whether the layer wants to "auto-:utf8" the stream.</p>
<p>utf8::is_utf8() has been added as a quick way to test whether
a scalar is encoded internally in UTF-8 (Unicode).</p>
<p>
</p>
<hr />
<h1><a name="modules_and_pragmata">Modules and Pragmata</a></h1>
<p>
</p>
<h2><a name="updated_modules_and_pragmata">Updated Modules And Pragmata</a></h2>
<p>The following modules and pragmata have been updated since Perl 5.8.0:</p>
<dl>
<dt><strong><a name="item_base">base</a></strong>
<dt><strong><a name="item_b_3a_3abytecode">B::Bytecode</a></strong>
<dd>
<p>In much better shape than it used to be. Still far from perfect, but
maybe worth a try.</p>
</dd>
</li>
<dt><strong><a name="item_b_3a_3aconcise">B::Concise</a></strong>
<dt><strong><a name="item_b_3a_3adeparse">B::Deparse</a></strong>
<dt><strong><a name="item_benchmark">Benchmark</a></strong>
<dd>
<p>An optional feature, <code>:hireswallclock</code>, now allows for high
resolution wall clock times (uses Time::HiRes).</p>
</dd>
</li>
<dt><strong><a name="item_byteloader">ByteLoader</a></strong>
<dd>
<p>See B::Bytecode.</p>
</dd>
</li>
<dt><strong><a name="item_bytes">bytes</a></strong>
<dd>
<p>Now has bytes::substr.</p>
</dd>
</li>
<dt><strong><a name="item_cgi">CGI</a></strong>
<dt><strong><a name="item_charnames">charnames</a></strong>
<dd>
<p>One can now have custom character name aliases.</p>
</dd>
</li>
<dt><strong><a name="item_cpan">CPAN</a></strong>
<dd>
<p>There is now a simple command line frontend to the CPAN.pm
module called <em>cpan</em>.</p>
</dd>
</li>
<dt><strong><a name="item_data_3a_3adumper">Data::Dumper</a></strong>
<dd>
<p>A new option, Pair, allows choosing the separator between hash keys
and values.</p>
</dd>
</li>
<dt><strong><a name="item_db_file">DB_File</a></strong>
<dt><strong><a name="item_devel_3a_3appport">Devel::PPPort</a></strong>
<dt><strong><a name="item_digest_3a_3amd5">Digest::MD5</a></strong>
<dt><strong><a name="item_encode">Encode</a></strong>
<dd>
<p>Significant updates on the encoding pragma functionality
(tr/// and the DATA filehandle, formats).</p>
</dd>
<dd>
<p>If a filehandle has been marked as to have an encoding, unmappable
characters are detected already during input, not later (when the
corrupted data is being used).</p>
</dd>
<dd>
<p>The ISO 8859-6 conversion table has been corrected (the 0x30..0x39
erroneously mapped to U+0660..U+0669, instead of U+0030..U+0039). The
GSM 03.38 conversion did not handle escape sequences correctly. The
UTF-7 encoding has been added (making Encode feature-complete with
Unicode::String).</p>
</dd>
</li>
<dt><strong><a name="item_fields">fields</a></strong>
<dt><strong><a name="item_libnet">libnet</a></strong>
<dt><strong><a name="item_math_3a_3abigint">Math::BigInt</a></strong>
<dd>
<p>A lot of bugs have been fixed since v1.60, the version included in Perl
v5.8.0. Especially noteworthy are the bug in Calc that caused div and mod to
fail for some large values, and the fixes to the handling of bad inputs.</p>
</dd>
<dd>
<p>Some new features were added, e.g. the <code>broot()</code> method, you can now pass
parameters to <code>config()</code> to change some settings at runtime, and it is now
possible to trap the creation of NaN and infinity.</p>
</dd>
<dd>
<p>As usual, some optimizations took place and made the math overall a tad
faster. In some cases, quite a lot faster, actually. Especially alternative
libraries like Math::BigInt::GMP benefit from this. In addition, a lot of the
quite clunky routines like <code>fsqrt()</code> and <code>flog()</code> are now much much faster.</p>
</dd>
</li>
<dt><strong><a name="item_mime_3a_3abase64">MIME::Base64</a></strong>
<dt><strong><a name="item_next">NEXT</a></strong>
<dd>
<p>Diamond inheritance now works.</p>
</dd>
</li>
<dt><strong><a name="item_net_3a_3aping">Net::Ping</a></strong>
<dt><strong><a name="item_perlio_3a_3ascalar">PerlIO::scalar</a></strong>
<dd>
<p>Reading from non-string scalars (like the special variables, see
<a href="../../lib/Pod/perlvar.html">the perlvar manpage</a>) now works.</p>
</dd>
</li>
<dt><strong><a name="item_podlators">podlators</a></strong>
<dt><strong><a name="item_pod_3a_3alatex">Pod::LaTeX</a></strong>
<dt><strong><a name="item_podparsers">PodParsers</a></strong>
<dt><strong><a name="item_pod_3a_3aperldoc">Pod::Perldoc</a></strong>
<dd>
<p>Complete rewrite. As a side-effect, no longer refuses to startup when
run by root.</p>
</dd>
</li>
<dt><strong><a name="item_scalar_3a_3autil">Scalar::Util</a></strong>
<dd>
<p>New utilities: refaddr, isvstring, looks_like_number, set_prototype.</p>
</dd>
</li>
<dt><strong><a name="item_storable">Storable</a></strong>
<dd>
<p>Can now store code references (via B::Deparse, so not foolproof).</p>
</dd>
</li>
<dt><strong><a name="item_strict">strict</a></strong>
<dd>
<p>Earlier versions of the strict pragma did not check the parameters
implicitly passed to its "import" (use) and "unimport" (no) routine.
This caused the false idiom such as:</p>
</dd>
<dd>
<pre>
<span class="keyword">use</span> <span class="variable">strict</span> <span class="string">qw(@ISA)</span><span class="operator">;</span>
<span class="variable">@ISA</span> <span class="operator">=</span> <span class="string">qw(Foo)</span><span class="operator">;</span>
</pre>
</dd>
<dd>
<p>This however (probably) raised the false expectation that the strict
refs, vars and subs were being enforced (and that @ISA was somehow
"declared"). But the strict refs, vars, and subs are <strong>not</strong> enforced
when using this false idiom.</p>
</dd>
<dd>
<p>Starting from Perl 5.8.1, the above <strong>will</strong> cause an error to be
raised. This may cause programs which used to execute seemingly
correctly without warnings and errors to fail when run under 5.8.1.
This happens because</p>
</dd>
<dd>
<pre>
<span class="keyword">use</span> <span class="variable">strict</span> <span class="string">qw(@ISA)</span><span class="operator">;</span>
</pre>
</dd>
<dd>
<p>will now fail with the error:</p>
</dd>
<dd>
<pre>
Unknown 'strict' tag(s) '@ISA'</pre>
</dd>
<dd>
<p>The remedy to this problem is to replace this code with the correct idiom:</p>
</dd>
<dd>
<pre>
<span class="keyword">use</span> <span class="variable">strict</span><span class="operator">;</span>
<span class="keyword">use</span> <span class="variable">vars</span> <span class="string">qw(@ISA)</span><span class="operator">;</span>
<span class="variable">@ISA</span> <span class="operator">=</span> <span class="string">qw(Foo)</span><span class="operator">;</span>
</pre>
</dd>
</li>
<dt><strong><a name="item_term_3a_3aansicolor">Term::ANSIcolor</a></strong>
<dt><strong><a name="item_test_3a_3aharness">Test::Harness</a></strong>
<dd>
<p>Now much more picky about extra or missing output from test scripts.</p>
</dd>
</li>
<dt><strong><a name="item_test_3a_3amore">Test::More</a></strong>
<dt><strong><a name="item_test_3a_3asimple">Test::Simple</a></strong>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?