📄 perl58delta.1
字号:
in most \s-1UNIX\s0 platforms). (\fIbsd_glob()\fR does still sort platformnatively, \s-1ASCII\s0 or \s-1EBCDIC\s0, unless \s-1GLOB_ALPHASORT\s0 is specified.) [561].Sh "Deprecations".IX Subsection "Deprecations".IP "\(bu" 4The semantics of bless(\s-1REF\s0, \s-1REF\s0) were unclear and until someone provesit to make some sense, it is forbidden..IP "\(bu" 4The obsolete chat2 library that should never have been allowedto escape the laboratory has been decommissioned..IP "\(bu" 4Using chdir("") or chdir(undef) instead of explicit \fIchdir()\fR isdoubtful. A failure (think chdir(\fIsome_function()\fR) can lead intounintended \fIchdir()\fR to the home directory, therefore this behaviouris deprecated..IP "\(bu" 4The builtin \fIdump()\fR function has probably outlived most of itsusefulness. The core-dumping functionality will remain in futureavailable as an explicit call to \f(CW\*(C`CORE::dump()\*(C'\fR, but in futurereleases the behaviour of an unqualified \f(CW\*(C`dump()\*(C'\fR call may change..IP "\(bu" 4The very dusty examples in the eg/ directory have been removed.Suggestions for new shiny examples welcome but the main issue is thatthe examples need to be documented, tested and (most importantly)maintained..IP "\(bu" 4The (bogus) escape sequences \e8 and \e9 now give an optional warning(\*(L"Unrecognized escape passed through\*(R"). There is no need to \e\-escapeany \f(CW\*(C`\ew\*(C'\fR character..IP "\(bu" 4The *glob{\s-1FILEHANDLE\s0} is deprecated, use *glob{\s-1IO\s0} instead..IP "\(bu" 4The \f(CW\*(C`package;\*(C'\fR syntax (\f(CW\*(C`package\*(C'\fR without an argument) has beendeprecated. Its semantics were never that clear and itsimplementation even less so. If you have used that feature todisallow all but fully qualified variables, \f(CW\*(C`use strict;\*(C'\fR instead..IP "\(bu" 4The unimplemented \s-1POSIX\s0 regex features [[.cc.]] and [[=c=]] are stillrecognised but now cause fatal errors. The previous behaviour ofignoring them by default and warning if requested was unacceptablesince it, in a way, falsely promised that the features could be used..IP "\(bu" 4In future releases, non-PerlIO aware \s-1XS\s0 modules may become completelyunsupported. Since PerlIO is a drop-in replacement for stdio at thesource code level, this shouldn't be that drastic a change..IP "\(bu" 4Previous versions of perl and some readings of some sections of Camel\&\s-1III\s0 implied that the \f(CW\*(C`:raw\*(C'\fR \*(L"discipline\*(R" was the inverse of \f(CW\*(C`:crlf\*(C'\fR.Turning off \*(L"clrfness\*(R" is no longer enough to make a stream trulybinary. So the PerlIO \f(CW\*(C`:raw\*(C'\fR layer (or \*(L"discipline\*(R", to use the Camelbook's older terminology) is now formally defined as being equivalentto binmode(\s-1FH\s0) \- which is in turn defined as doing whatever isnecessary to pass each byte as-is without any translation. Inparticular binmode(\s-1FH\s0) \- and hence \f(CW\*(C`:raw\*(C'\fR \- will now turn off both\&\s-1CRLF\s0 and \s-1UTF\-8\s0 translation and remove other layers (e.g. :\fIencoding()\fR)which would modify byte stream..IP "\(bu" 4The current user-visible implementation of pseudo-hashes (the weirduse of the first array element) is deprecated starting from Perl 5.8.0and will be removed in Perl 5.10.0, and the feature will beimplemented differently. Not only is the current interface ratherugly, but the current implementation slows down normal array and hashuse quite noticeably. The \f(CW\*(C`fields\*(C'\fR pragma interface will remainavailable. The \fIrestricted hashes\fR interface is expected tobe the replacement interface (see Hash::Util). If your existingprograms depends on the underlying implementation, consider usingClass::PseudoHash from \s-1CPAN\s0..IP "\(bu" 4The syntaxes \f(CW\*(C`@a\->[...]\*(C'\fR and \f(CW\*(C`%h\->{...}\*(C'\fR have now been deprecated..IP "\(bu" 4After years of trying, suidperl is considered to be too complex toever be considered truly secure. The suidperl functionality is likelyto be removed in a future release..IP "\(bu" 4The 5.005 threads model (module \f(CW\*(C`Thread\*(C'\fR) is deprecated and expectedto be removed in Perl 5.10. Multithreaded code should be migrated tothe new ithreads model (see threads, threads::shared andperlthrtut)..IP "\(bu" 4The long deprecated uppercase aliases for the string comparisonoperators (\s-1EQ\s0, \s-1NE\s0, \s-1LT\s0, \s-1LE\s0, \s-1GE\s0, \s-1GT\s0) have now been removed..IP "\(bu" 4The tr///C and tr///U features have been removed and will not return;the interface was a mistake. Sorry about that. For similarfunctionality, see pack('U0', ...) and pack('C0', ...). [561].IP "\(bu" 4Earlier Perls treated \*(L"sub foo (@bar)\*(R" as equivalent to \*(L"sub foo (@)\*(R".The prototypes are now checked better at compile-time for invalidsyntax. An optional warning is generated (\*(L"Illegal character inprototype...\*(R") but this may be upgraded to a fatal error in a futurerelease..IP "\(bu" 4The \f(CW\*(C`exec LIST\*(C'\fR and \f(CW\*(C`system LIST\*(C'\fR operations now produce warnings ontainted data and in some future release they will produce fatal errors..IP "\(bu" 4The existing behaviour when localising tied arrays and hashes is wrong,and will be changed in a future release, so do not rely on the existingbehaviour. See \*(L"Localising Tied Arrays and Hashes Is Broken\*(R"..SH "Core Enhancements".IX Header "Core Enhancements".Sh "Unicode Overhaul".IX Subsection "Unicode Overhaul"Unicode in general should be now much more usable than in Perl 5.6.0(or even in 5.6.1). Unicode can be used in hash keys, Unicode inregular expressions should work now, Unicode in tr/// should work now,Unicode in I/O should work now. See perluniintro for introductionand perlunicode for details..IP "\(bu" 4The Unicode Character Database coming with Perl has been upgradedto Unicode 3.2.0. For more information, see http://www.unicode.org/ .[561+] (5.6.1 has \s-1UCD\s0 3.0.1.).IP "\(bu" 4For developers interested in enhancing Perl's Unicode capabilities:almost all the \s-1UCD\s0 files are included with the Perl distribution inthe \fIlib/unicore\fR subdirectory. The most notable omission, for spaceconsiderations, is the Unihan database..IP "\(bu" 4The properties \ep{Blank} and \ep{SpacePerl} have been added. \*(L"Blank\*(R" is likeC \fIisblank()\fR, that is, it contains only \*(L"horizontal whitespace\*(R" (the spacecharacter is, the newline isn't), and the \*(L"SpacePerl\*(R" is the Unicodeequivalent of \f(CW\*(C`\es\*(C'\fR (\ep{Space} isn't, since that includes the verticaltabulator character, whereas \f(CW\*(C`\es\*(C'\fR doesn't.).SpSee \*(L"New Unicode Properties\*(R" earlier in this document for additionalinformation on changes with Unicode properties..Sh "PerlIO is Now The Default".IX Subsection "PerlIO is Now The Default".IP "\(bu" 4\&\s-1IO\s0 is now by default done via PerlIO rather than system's \*(L"stdio\*(R".PerlIO allows \*(L"layers\*(R" to be \*(L"pushed\*(R" onto a file handle to alter thehandle's behaviour. Layers can be specified at open time via 3\-argform of open:.Sp.Vb 1\& open($fh,\*(Aq>:crlf :utf8\*(Aq, $path) || ....Ve.Spor on already opened handles via extended \f(CW\*(C`binmode\*(C'\fR:.Sp.Vb 1\& binmode($fh,\*(Aq:encoding(iso\-8859\-7)\*(Aq);.Ve.SpThe built-in layers are: unix (low level read/write), stdio (as inprevious Perls), perlio (re-implementation of stdio buffering in aportable manner), crlf (does \s-1CRLF\s0 <=> \*(L"\en\*(R" translation as on Win32,but available on any platform). A mmap layer may be available ifplatform supports it (mostly UNIXes)..SpLayers to be applied by default may be specified via the 'open' pragma..SpSee \*(L"Installation and Configuration Improvements\*(R" for the effectsof PerlIO on your architecture name..IP "\(bu" 4If your platform supports \fIfork()\fR, you can use the list form of \f(CW\*(C`open\*(C'\fRfor pipes. For example:.Sp.Vb 1\& open KID_PS, "\-|", "ps", "aux" or die $!;.Ve.Spforks the \fIps\fR\|(1) command (without spawning a shell, as there are morethan three arguments to \fIopen()\fR), and reads its standard output via the\&\f(CW\*(C`KID_PS\*(C'\fR filehandle. See perlipc..IP "\(bu" 4File handles can be marked as accepting Perl's internal encoding of Unicode(\s-1UTF\-8\s0 or UTF-EBCDIC depending on platform) by a pseudo layer \*(L":utf8\*(R" :.Sp.Vb 1\& open($fh,">:utf8","Uni.txt");.Ve.SpNote for \s-1EBCDIC\s0 users: the pseudo layer \*(L":utf8\*(R" is erroneously namedfor you since it's not \s-1UTF\-8\s0 what you will be getting but insteadUTF-EBCDIC. See perlunicode, utf8, andhttp://www.unicode.org/unicode/reports/tr16/ for more information.In future releases this naming may change. See perluniintrofor more information about \s-1UTF\-8\s0..IP "\(bu" 4If your environment variables (\s-1LC_ALL\s0, \s-1LC_CTYPE\s0, \s-1LANG\s0) look like youwant to use \s-1UTF\-8\s0 (any of the variables match \f(CW\*(C`/utf\-?8/i\*(C'\fR), your\&\s-1STDIN\s0, \s-1STDOUT\s0, \s-1STDERR\s0 handles and the default open layer (see open)are marked as \s-1UTF\-8\s0. (This feature, like other new features thatcombine Unicode and I/O, work only if you are using PerlIO, but that'sthe default.).SpNote that after this Perl really does assume that everything is \s-1UTF\-8:\s0for example if some input handle is not, Perl will probably very sooncomplain about the input data like this \*(L"Malformed \s-1UTF\-8\s0 ...\*(R" sinceany old eight-bit data is not legal \s-1UTF\-8\s0..SpNote for code authors: if you want to enable your users to use \s-1UTF\-8\s0as their default encoding but in your code still have eight-bit I/O streams(such as images or zip files), you need to explicitly \fIopen()\fR or \fIbinmode()\fRwith \f(CW\*(C`:bytes\*(C'\fR (see \*(L"open\*(R" in perlfunc and \*(L"binmode\*(R" in perlfunc), or youcan just use \f(CW\*(C`binmode(FH)\*(C'\fR (nice for pre\-5.8.0 backward compatibility)..IP "\(bu" 4File handles can translate character encodings from/to Perl's internalUnicode form on read/write via the \*(L":\fIencoding()\fR\*(R" layer..IP "\(bu" 4File handles can be opened to \*(L"in memory\*(R" files held in Perl scalars via:.Sp.Vb 1\& open($fh,\*(Aq>\*(Aq, \e$variable) || ....Ve.IP "\(bu" 4Anonymous temporary files are available without need to\&'use FileHandle' or other module via.Sp.Vb 1\& open($fh,"+>", undef) || ....Ve.SpThat is a literal undef, not an undefined value..Sh "ithreads".IX Subsection "ithreads"The new interpreter threads (\*(L"ithreads\*(R" for short) implementation ofmultithreading, by Arthur Bergman, replaces the old \*(L"5.005 threads\*(R"implementation. In the ithreads model any data sharing betweenthreads must be explicit, as opposed to the model where data sharingwas implicit. See threads and threads::shared, andperlthrtut..PPAs a part of the ithreads implementation Perl will also useany necessary and detectable reentrant libc interfaces..Sh "Restricted Hashes".IX Subsection "Restricted Hashes"A restricted hash is restricted to a certain set of keys, no keysoutside the set can be added. Also individual keys can be restrictedso that the key cannot be deleted and the value cannot be changed.No new syntax is involved: the Hash::Util module is the interface..Sh "Safe Signals".IX Subsection "Safe Signals"Perl used to be fragile in that signals arriving at inopportune momentscould corrupt Perl's internal state. Now Perl postpones handling ofsignals until it's safe (between opcodes)..PPThis change may have surprising side effects because signals no longerinterrupt Perl instantly. Perl will now first finish whatever it wasdoing, like finishing an internal operation (like \fIsort()\fR) or anexternal operation (like an I/O operation), and only then look at anyarrived signals (and before starting the next operation). No more corruptinternal state since the current operation is always finished first,but the signal may take more time to get heard. Note that breakingout from potentially blocking operations should still work, though..Sh "Understanding of Numbers".IX Subsection "Understanding of Numbers"In general a lot of fixing has happened in the area of Perl'sunderstanding of numbers, both integer and floating point. Since inmany systems the standard number parsing functions like \f(CW\*(C`strtoul()\*(C'\fRand \f(CW\*(C`atof()\*(C'\fR seem to have bugs, Perl tries to work around theirdeficiencies. This results hopefully in more accurate numbers..PPPerl now tries internally to use integer values in numeric conversionsand basic arithmetics (+ \- * /) if the arguments are integers, andtries also to keep the results stored internally as integers.This change leads to often slightly faster and always less lossyarithmetics. (Previously Perl always preferred floating point numbersin its math.).Sh "Arrays now always interpolate into double-quoted strings [561]".IX Subsection "Arrays now always interpolate into double-quoted strings [561]"In double-quoted strings, arrays now interpolate, no matter what. Thebehavior in earlier versions of perl 5 was that arrays would interpolateinto strings if the array had been mentioned before the string wascompiled, and otherwise Perl would raise a fatal compile-time error.In versions 5.000 through 5.003, the error was.PP.Vb 1\& Literal @example now requires backslash.Ve.PPIn versions 5.004_01 through 5.6.0, the error was.PP.Vb 1\& In string, @example now must be written as \e@example.Ve.PPThe idea here was to get people into the habit of writing\&\f(CW"fred\e@example.com"\fR when they wanted a literal \f(CW\*(C`@\*(C'\fR sign, just asthey have always written \f(CW"Give me back my \e$5"\fR when they wanted aliteral \f(CW\*(C`$\*(C'\fR sign..PPStarting with 5.6.1, when Perl now sees an \f(CW\*(C`@\*(C'\fR sign in adouble-quoted string, it \fIalways\fR attempts to interpolate an array,regardless of whether or not the array has been used or declaredalready. The fatal error has been downgraded to an optional warning:.PP.Vb 1\& Possible unintended interpolation of @example in string.Ve.PP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -