perl595delta.pod
来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· POD 代码 · 共 594 行 · 第 1/2 页
POD
594 行
=head1 NAMEperl595delta - what is new for perl v5.9.5=head1 DESCRIPTIONThis document describes differences between the 5.9.4 and the 5.9.5development releases. See L<perl590delta>, L<perl591delta>,L<perl592delta>, L<perl593delta> and L<perl594delta> for the differencesbetween 5.8.0 and 5.9.4.=head1 Incompatible Changes=head2 Tainting and printfWhen perl is run under taint mode, C<printf()> and C<sprintf()> will nowreject any tainted format argument. (Rafael Garcia-Suarez)=head2 undef and signal handlersUndefining or deleting a signal handler via C<undef $SIG{FOO}> is nowequivalent to setting it to C<'DEFAULT'>. (Rafael)=head2 strictures and array/hash dereferencing in defined()C<defined @$foo> and C<defined %$bar> are now subject to C<strict 'refs'>(that is, C<$foo> and C<$bar> shall be proper references there.)(Nicholas Clark)(However, C<defined(@foo)> and C<defined(%bar)> are discouraged constructsanyway.)=head2 C<(?p{})> has been removedThe regular expression construct C<(?p{})>, which was deprecated in perl5.8, has been removed. Use C<(??{})> instead. (Rafael)=head2 Pseudo-hashes have been removedSupport for pseudo-hashes has been removed from Perl 5.9. (The C<fields>pragma remains here, but uses an alternate implementation.)=head2 Removal of the bytecode compiler and of perlccC<perlcc>, the byteloader and the supporting modules (B::C, B::CC,B::Bytecode, etc.) are no longer distributed with the perl sources. Thoseexperimental tools have never worked reliably, and, due to the lack ofvolunteers to keep them in line with the perl interpreter developments, itwas decided to remove them instead of shipping a broken version of those.The last version of those modules can be found with perl 5.9.4.However the B compiler framework stays supported in the perl core, as withthe more useful modules it has permitted (among others, B::Deparse andB::Concise).=head2 Removal of the JPLThe JPL (Java-Perl Linguo) has been removed from the perl sources tarball.=head2 Recursive inheritance detected earlierPerl will now immediately throw an exception if you modify any package'sC<@ISA> in such a way that it would cause recursive inheritance.Previously, the exception would not occur until Perl attempted to makeuse of the recursive inheritance while resolving a method or doing aC<$foo-E<gt>isa($bar)> lookup.=head1 Core Enhancements=head2 Regular expressions=over 4=item Recursive PatternsIt is now possible to write recursive patterns without using the C<(??{})>construct. This new way is more efficient, and in many cases easier toread.Each capturing parenthesis can now be treated as an independent patternthat can be entered by using the C<(?PARNO)> syntax (C<PARNO> standing for"parenthesis number"). For example, the following pattern will matchnested balanced angle brackets: / ^ # start of line ( # start capture buffer 1 < # match an opening angle bracket (?: # match one of: (?> # don't backtrack over the inside of this group [^<>]+ # one or more non angle brackets ) # end non backtracking group | # ... or ... (?1) # recurse to bracket 1 and try it again )* # 0 or more times. > # match a closing angle bracket ) # end capture buffer one $ # end of line /xNote, users experienced with PCRE will find that the Perl implementationof this feature differs from the PCRE one in that it is possible tobacktrack into a recursed pattern, whereas in PCRE the recursion isatomic or "possessive" in nature. (Yves Orton)=item Named Capture BuffersIt is now possible to name capturing parenthesis in a pattern and refer tothe captured contents by name. The naming syntax is C<< (?<NAME>....) >>.It's possible to backreference to a named buffer with the C<< \k<NAME> >>syntax. In code, the new magical hashes C<%+> and C<%-> can be used toaccess the contents of the capture buffers.Thus, to replace all doubled chars, one could write s/(?<letter>.)\k<letter>/$+{letter}/gOnly buffers with defined contents will be "visible" in the C<%+> hash, soit's possible to do something like foreach my $name (keys %+) { print "content of buffer '$name' is $+{$name}\n"; }The C<%-> hash is a bit more complete, since it will contain array refsholding values from all capture buffers similarly named, if there shouldbe many of them.C<%+> and C<%-> are implemented as tied hashes through the new moduleC<Tie::Hash::NamedCapture>.Users exposed to the .NET regex engine will find that the perlimplementation differs in that the numerical ordering of the buffersis sequential, and not "unnamed first, then named". Thus in the pattern /(A)(?<B>B)(C)(?<D>D)/$1 will be 'A', $2 will be 'B', $3 will be 'C' and $4 will be 'D' and not$1 is 'A', $2 is 'C' and $3 is 'B' and $4 is 'D' that a .NET programmerwould expect. This is considered a feature. :-) (Yves Orton)=item Possessive QuantifiersPerl now supports the "possessive quantifier" syntax of the "atomic match"pattern. Basically a possessive quantifier matches as much as it can and nevergives any back. Thus it can be used to control backtracking. The syntax issimilar to non-greedy matching, except instead of using a '?' as the modifierthe '+' is used. Thus C<?+>, C<*+>, C<++>, C<{min,max}+> are now legalquantifiers. (Yves Orton)=item Backtracking control verbsThe regex engine now supports a number of special-purpose backtrackcontrol verbs: (*THEN), (*PRUNE), (*MARK), (*SKIP), (*COMMIT), (*FAIL)and (*ACCEPT). See L<perlre> for their descriptions. (Yves Orton)=item Relative backreferencesA new syntax C<\g{N}> or C<\gN> where "N" is a decimal integer allows asafer form of back-reference notation as well as allowing relativebackreferences. This should make it easier to generate and embed patternsthat contain backreferences. See L<perlre/"Capture buffers">. (Yves Orton)=item C<\K> escapeThe functionality of Jeff Pinyan's module Regexp::Keep has been added tothe core. You can now use in regular expressions the special escape C<\K>as a way to do something like floating length positive lookbehind. It isalso useful in substitutions like: s/(foo)bar/$1/gthat can now be converted to s/foo\Kbar//gwhich is much more efficient. (Yves Orton)=item Vertical and horizontal whitespace, and linebreakRegular expressions now recognize the C<\v> and C<\h> escapes, that matchvertical and horizontal whitespace, respectively. C<\V> and C<\H>logically match their complements.C<\R> matches a generic linebreak, that is, vertical whitespace, plusthe multi-character sequence C<"\x0D\x0A">.=back=head2 The C<_> prototypeA new prototype character has been added. C<_> is equivalent to C<$> (itdenotes a scalar), but defaults to C<$_> if the corresponding argumentisn't supplied. Due to the optional nature of the argument, you can onlyuse it at the end of a prototype, or before a semicolon.This has a small incompatible consequence: the prototype() function hasbeen adjusted to return C<_> for some built-ins in appropriate cases (forexample, C<prototype('CORE::rmdir')>). (Rafael)=head2 UNITCHECK blocksC<UNITCHECK>, a new special code block has been introduced, in addition toC<BEGIN>, C<CHECK>, C<INIT> and C<END>.C<CHECK> and C<INIT> blocks, while useful for some specialized purposes,are always executed at the transition between the compilation and theexecution of the main program, and thus are useless whenever code isloaded at runtime. On the other hand, C<UNITCHECK> blocks are executedjust after the unit which defined them has been compiled. See L<perlmod>for more information. (Alex Gough)=head2 readpipe() is now overridableThe built-in function readpipe() is now overridable. Overriding it permitsalso to override its operator counterpart, C<qx//> (a.k.a. C<``>).Moreover, it now defaults to C<$_> if no argument is provided. (Rafael)=head2 default argument for readline()readline() now defaults to C<*ARGV> if no argument is provided. (Rafael)=head2 UCD 5.0.0The copy of the Unicode Character Database included in Perl 5.9 hasbeen updated to version 5.0.0.=head2 Smart matchThe smart match operator (C<~~>) is now available by default (you don'tneed to enable it with C<use feature> any longer). (Michael G Schwern)=head2 Implicit loading of C<feature>The C<feature> pragma is now implicitly loaded when you require a minimalperl version (with the C<use VERSION> construct) greater than, or equalto, 5.9.5.=head1 Modules and Pragmas=head2 New Pragma, C<mro>A new pragma, C<mro> (for Method Resolution Order) has been added. Itpermits to switch, on a per-class basis, the algorithm that perl uses tofind inherited methods in case of a multiple inheritance hierarchy. Thedefault MRO hasn't changed (DFS, for Depth First Search). Another MRO isavailable: the C3 algorithm. See L<mro> for more information.(Brandon Black)Note that, due to changes in the implementation of class hierarchy search,code that used to undef the C<*ISA> glob will most probably break. Anyway,undef'ing C<*ISA> had the side-effect of removing the magic on the @ISAarray and should not have been done in the first place.=head2 bignum, bigint, bigratThe three numeric pragmas C<bignum>, C<bigint> and C<bigrat> are nowlexically scoped. (Tels)=head2 Math::BigInt/Math::BigFloatMany bugs have been fixed; noteworthy are comparisons with NaN, whichno longer warn about undef values.The following things are new:=over 4=item config()The config() method now also supports the calling-styleC<< config('lib') >> in addition to C<< config()->{'lib'} >>.=item import()Upon import, using C<< lib => 'Foo' >> now warns if the low-level librarycannot be found. To suppress the warning, you can use C<< try => 'Foo' >>instead. To convert the warning into a die, use C<< only => 'Foo' >>instead.=item roundmode commonA rounding mode of C<common> is now supported.=backAlso, support for the following methods has been added:=over 4=item bpi(), bcos(), bsin(), batan(), batan2()=item bmuladd()=item bexp(), bnok()
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?