📄 perl590delta.1
字号:
.PPis merely equivalent to.PP.Vb 1\& defined $a ? $a : $b.Ve.PPand.PP.Vb 1\& $c //= $d;.Ve.PPcan be used instead of.PP.Vb 1\& $c = $d unless defined $c;.Ve.PPThis operator has the same precedence and associativity as \f(CW\*(C`||\*(C'\fR.It has a low-precedence counterpart, \f(CW\*(C`err\*(C'\fR, which has the same precedenceand associativity as \f(CW\*(C`or\*(C'\fR. Special care has been taken to ensure thatthose operators Do What You Mean while not breaking old code, but someedge cases involving the empty regular expression may now parsedifferently. See perlop for details..Sh "\s-1UTF\-8\s0 no longer default under \s-1UTF\-8\s0 locales".IX Subsection "UTF-8 no longer default under UTF-8 locales"In Perl 5.8.0 many Unicode features were introduced. One of themwas found to be of more nuisance than benefit: the automagic(and silent) \*(L"UTF\-8\-ification\*(R" of filehandles, including thestandard filehandles, if the user's locale settings indicateduse of \s-1UTF\-8\s0..PPFor example, if you had \f(CW\*(C`en_US.UTF\-8\*(C'\fR as your locale, your \s-1STDIN\s0 and\&\s-1STDOUT\s0 were automatically \*(L"\s-1UTF\-8\s0\*(R", in other words an implicitbinmode(..., \*(L":utf8\*(R") was made. This meant that trying to print, say,\&\fIchr\fR\|(0xff), ended up printing the bytes 0xc3 0xbf. Hardly whatyou 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 examplein RedHat releases 8 and 9 the \fBdefault\fR locale setting is \s-1UTF\-8\s0, soall RedHat users got \s-1UTF\-8\s0 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/// andtr///. (Bugs that have been fixed in 5.8.1).PPTherefore a decision was made to backtrack the feature and change itfrom implicit silent default to explicit conscious option. The newPerl command line option \f(CW\*(C`\-C\*(C'\fR and its counterpart environmentvariable \s-1PERL_UNICODE\s0 can now be used to control how Perl and Unicodeinteract at interfaces like I/O and for example the command linearguments. See \*(L"\-C\*(R" in perlrun and \*(L"\s-1PERL_UNICODE\s0\*(R" in perlrun for moreinformation..Sh "Unsafe signals again available".IX Subsection "Unsafe signals again available"In Perl 5.8.0 the so-called \*(L"safe signals\*(R" were introduced. Thismeans that Perl no longer handles signals immediately but instead\&\*(L"between opcodes\*(R", when it is safe to do so. The earlier immediatehandling easily could corrupt the internal state of Perl, resultingin mysterious crashes..PPHowever, the new safer model has its problems too. Because now anopcode, a basic unit of Perl execution, is never interrupted butinstead let to run to completion, certain operations that can take along time now really do take a long time. For example, certainnetwork operations have their own blocking and timeout mechanisms, andbeing able to interrupt them immediately would be nice..PPTherefore perl 5.8.1 introduced a \*(L"backdoor\*(R" to restore the pre\-5.8.0(pre\-5.7.3, really) signal behaviour. Just set the environment variable\&\s-1PERL_SIGNALS\s0 to \f(CW\*(C`unsafe\*(C'\fR, and the old immediate (and unsafe)signal handling behaviour returns. See \*(L"\s-1PERL_SIGNALS\s0\*(R" in perlrunand \*(L"Deferred Signals (Safe Signals)\*(R" in perlipc..PPIn completely unrelated news, you can now use safe signals withPOSIX::SigAction. See \*(L"POSIX::SigAction\*(R" in \s-1POSIX\s0..Sh "Tied Arrays with Negative Array Indices".IX Subsection "Tied Arrays with Negative Array Indices"Formerly, the indices passed to \f(CW\*(C`FETCH\*(C'\fR, \f(CW\*(C`STORE\*(C'\fR, \f(CW\*(C`EXISTS\*(C'\fR, and\&\f(CW\*(C`DELETE\*(C'\fR methods in tied array class were always non-negative. Ifthe actual argument was negative, Perl would call \s-1FETCHSIZE\s0 implicitlyand add the result to the index before passing the result to the tiedarray method. This behaviour is now optional. If the tied array classcontains a package variable named \f(CW$NEGATIVE_INDICES\fR which is set toa true value, negative values will be passed to \f(CW\*(C`FETCH\*(C'\fR, \f(CW\*(C`STORE\*(C'\fR,\&\f(CW\*(C`EXISTS\*(C'\fR, and \f(CW\*(C`DELETE\*(C'\fR unchanged..Sh "local ${$x}".IX Subsection "local ${$x}"The syntaxes.PP.Vb 3\& local ${$x}\& local @{$x}\& local %{$x}.Ve.PPnow do localise variables, given that the \f(CW$x\fR is a valid variable name..Sh "Unicode Character Database 4.0.0".IX Subsection "Unicode Character Database 4.0.0"The copy of the Unicode Character Database included in Perl 5.8 hasbeen updated to 4.0.0 from 3.2.0. This means for example that theUnicode character properties are as in Unicode 4.0.0..Sh "Miscellaneous Enhancements".IX Subsection "Miscellaneous Enhancements"\&\f(CW\*(C`unpack()\*(C'\fR now defaults to unpacking the \f(CW$_\fR..PP\&\f(CW\*(C`map\*(C'\fR in void context is no longer expensive. \f(CW\*(C`map\*(C'\fR is now contextaware, and will not construct a list if called in void context..PPIf a socket gets closed by the server while printing to it, the clientnow gets a \s-1SIGPIPE\s0. While this new feature was not planned, it fellnaturally out of PerlIO changes, and is to be considered an accidentalfeature..PPPerlIO::get_layers(\s-1FH\s0) returns the names of the PerlIO layersactive on a filehandle..PPPerlIO::via layers can now have an optional \s-1UTF8\s0 method toindicate whether the layer wants to \*(L"auto\-:utf8\*(R" the stream..PP\&\fIutf8::is_utf8()\fR has been added as a quick way to test whethera scalar is encoded internally in \s-1UTF\-8\s0 (Unicode)..SH "Modules and Pragmata".IX Header "Modules and Pragmata".Sh "Updated Modules And Pragmata".IX Subsection "Updated Modules And Pragmata"The following modules and pragmata have been updated since Perl 5.8.0:.IP "base" 4.IX Item "base".PD 0.IP "B::Bytecode" 4.IX Item "B::Bytecode".PDIn much better shape than it used to be. Still far from perfect, butmaybe worth a try..IP "B::Concise" 4.IX Item "B::Concise".PD 0.IP "B::Deparse" 4.IX Item "B::Deparse".IP "Benchmark" 4.IX Item "Benchmark".PDAn optional feature, \f(CW\*(C`:hireswallclock\*(C'\fR, now allows for highresolution wall clock times (uses Time::HiRes)..IP "ByteLoader" 4.IX Item "ByteLoader"See B::Bytecode..IP "bytes" 4.IX Item "bytes"Now has bytes::substr..IP "\s-1CGI\s0" 4.IX Item "CGI".PD 0.IP "charnames" 4.IX Item "charnames".PDOne can now have custom character name aliases..IP "\s-1CPAN\s0" 4.IX Item "CPAN"There is now a simple command line frontend to the \s-1CPAN\s0.pmmodule called \fIcpan\fR..IP "Data::Dumper" 4.IX Item "Data::Dumper"A new option, Pair, allows choosing the separator between hash keysand values..IP "DB_File" 4.IX Item "DB_File".PD 0.IP "Devel::PPPort" 4.IX Item "Devel::PPPort".IP "Digest::MD5" 4.IX Item "Digest::MD5".IP "Encode" 4.IX Item "Encode".PDSignificant updates on the encoding pragma functionality(tr/// and the \s-1DATA\s0 filehandle, formats)..SpIf a filehandle has been marked as to have an encoding, unmappablecharacters are detected already during input, not later (when thecorrupted data is being used)..SpThe \s-1ISO\s0 8859\-6 conversion table has been corrected (the 0x30..0x39erroneously mapped to U+0660..U+0669, instead of U+0030..U+0039). The\&\s-1GSM\s0 03.38 conversion did not handle escape sequences correctly. The\&\s-1UTF\-7\s0 encoding has been added (making Encode feature-complete withUnicode::String)..IP "fields" 4.IX Item "fields".PD 0.IP "libnet" 4.IX Item "libnet".IP "Math::BigInt" 4.IX Item "Math::BigInt".PDA lot of bugs have been fixed since v1.60, the version included in Perlv5.8.0. Especially noteworthy are the bug in Calc that caused div and mod tofail for some large values, and the fixes to the handling of bad inputs..SpSome new features were added, e.g. the \fIbroot()\fR method, you can now passparameters to \fIconfig()\fR to change some settings at runtime, and it is nowpossible to trap the creation of NaN and infinity..SpAs usual, some optimizations took place and made the math overall a tadfaster. In some cases, quite a lot faster, actually. Especially alternativelibraries like Math::BigInt::GMP benefit from this. In addition, a lot of thequite clunky routines like \fIfsqrt()\fR and \fIflog()\fR are now much much faster..IP "MIME::Base64" 4.IX Item "MIME::Base64".PD 0.IP "\s-1NEXT\s0" 4.IX Item "NEXT".PDDiamond inheritance now works..IP "Net::Ping" 4.IX Item "Net::Ping".PD 0.IP "PerlIO::scalar" 4.IX Item "PerlIO::scalar".PDReading from non-string scalars (like the special variables, seeperlvar) now works..IP "podlators" 4.IX Item "podlators".PD 0.IP "Pod::LaTeX" 4.IX Item "Pod::LaTeX".IP "PodParsers" 4.IX Item "PodParsers".IP "Pod::Perldoc" 4.IX Item "Pod::Perldoc".PDComplete rewrite. As a side-effect, no longer refuses to startup whenrun by root..IP "Scalar::Util" 4.IX Item "Scalar::Util"New utilities: refaddr, isvstring, looks_like_number, set_prototype..IP "Storable" 4.IX Item "Storable"Can now store code references (via B::Deparse, so not foolproof)..IP "strict" 4.IX Item "strict"Earlier versions of the strict pragma did not check the parametersimplicitly passed to its \*(L"import\*(R" (use) and \*(L"unimport\*(R" (no) routine.This caused the false idiom such as:.Sp.Vb 2\& use strict qw(@ISA);\& @ISA = qw(Foo);.Ve.SpThis however (probably) raised the false expectation that the strictrefs, vars and subs were being enforced (and that \f(CW@ISA\fR was somehow\&\*(L"declared\*(R"). But the strict refs, vars, and subs are \fBnot\fR enforcedwhen using this false idiom..SpStarting from Perl 5.8.1, the above \fBwill\fR cause an error to beraised. This may cause programs which used to execute seeminglycorrectly without warnings and errors to fail when run under 5.8.1.This happens because.Sp.Vb 1\& use strict qw(@ISA);.Ve.Spwill now fail with the error:.Sp.Vb 1\& Unknown \*(Aqstrict\*(Aq tag(s) \*(Aq@ISA\*(Aq.Ve.SpThe remedy to this problem is to replace this code with the correct idiom:.Sp.Vb 3
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -