⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 perl56delta.pod

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 POD
📖 第 1 页 / 共 5 页
字号:
=head1 NAMEperl56delta - what's new for perl v5.6.0=head1 DESCRIPTIONThis document describes differences between the 5.005 release and the 5.6.0release.=head1 Core Enhancements=head2 Interpreter cloning, threads, and concurrencyPerl 5.6.0 introduces the beginnings of support for running multipleinterpreters concurrently in different threads.  In conjunction withthe perl_clone() API call, which can be used to selectively duplicatethe state of any given interpreter, it is possible to compile apiece of code once in an interpreter, clone that interpreterone or more times, and run all the resulting interpreters in distinctthreads.On the Windows platform, this feature is used to emulate fork() at theinterpreter level.  See L<perlfork> for details about that.This feature is still in evolution.  It is eventually meant to be usedto selectively clone a subroutine and data reachable from thatsubroutine in a separate interpreter and run the cloned subroutinein a separate thread.  Since there is no shared data between theinterpreters, little or no locking will be needed (unless parts ofthe symbol table are explicitly shared).  This is obviously intendedto be an easy-to-use replacement for the existing threads support.Support for cloning interpreters and interpreter concurrency can beenabled using the -Dusethreads Configure option (see win32/Makefile forhow to enable it on Windows.)  The resulting perl executable will befunctionally identical to one that was built with -Dmultiplicity, butthe perl_clone() API call will only be available in the former.-Dusethreads enables the cpp macro USE_ITHREADS by default, which in turnenables Perl source code changes that provide a clear separation betweenthe op tree and the data it operates with.  The former is immutable, andcan therefore be shared between an interpreter and all of its clones,while the latter is considered local to each interpreter, and is thereforecopied for each clone.Note that building Perl with the -Dusemultiplicity Configure optionis adequate if you wish to run multiple B<independent> interpretersconcurrently in different threads.  -Dusethreads only provides theadditional functionality of the perl_clone() API call and othersupport for running B<cloned> interpreters concurrently.    NOTE: This is an experimental feature.  Implementation details are    subject to change.=head2 Lexically scoped warning categoriesYou can now control the granularity of warnings emitted by perl at a finerlevel using the C<use warnings> pragma.  L<warnings> and L<perllexwarn>have copious documentation on this feature.=head2 Unicode and UTF-8 supportPerl now uses UTF-8 as its internal representation for characterstrings.  The C<utf8> and C<bytes> pragmas are used to control this supportin the current lexical scope.  See L<perlunicode>, L<utf8> and L<bytes> formore information.This feature is expected to evolve quickly to support some form of I/Odisciplines that can be used to specify the kind of input and output data(bytes or characters).  Until that happens, additional modules from CPANwill be needed to complete the toolkit for dealing with Unicode.    NOTE: This should be considered an experimental feature.  Implementation    details are subject to change.=head2 Support for interpolating named charactersThe new C<\N> escape interpolates named characters within strings.For example, C<"Hi! \N{WHITE SMILING FACE}"> evaluates to a stringwith a unicode smiley face at the end.=head2 "our" declarationsAn "our" declaration introduces a value that can be best understoodas a lexically scoped symbolic alias to a global variable in thepackage that was current where the variable was declared.  This ismostly useful as an alternative to the C<vars> pragma, but also providesthe opportunity to introduce typing and other attributes for suchvariables.  See L<perlfunc/our>.=head2 Support for strings represented as a vector of ordinalsLiterals of the form C<v1.2.3.4> are now parsed as a string composedof characters with the specified ordinals.  This is an alternative, morereadable way to construct (possibly unicode) strings instead ofinterpolating characters, as in C<"\x{1}\x{2}\x{3}\x{4}">.  The leadingC<v> may be omitted if there are more than two ordinals, so C<1.2.3> isparsed the same as C<v1.2.3>.Strings written in this form are also useful to represent version "numbers".It is easy to compare such version "numbers" (which are really just plainstrings) using any of the usual string comparison operators C<eq>, C<ne>,C<lt>, C<gt>, etc., or perform bitwise string operations on them using C<|>,C<&>, etc.In conjunction with the new C<$^V> magic variable (which containsthe perl version as a string), such literals can be used as a readable wayto check if you're running a particular version of Perl:    # this will parse in older versions of Perl also    if ($^V and $^V gt v5.6.0) {        # new features supported    }C<require> and C<use> also have some special magic to support suchliterals, but this particular usage should be avoided because it leads tomisleading error messages under versions of Perl which don't support vectorstrings.  Using a true version number will ensure correct behavior in allversions of Perl:    require 5.006;    # run time check for v5.6    use 5.006_001;    # compile time check for v5.6.1Also, C<sprintf> and C<printf> support the Perl-specific format flag C<%v>to print ordinals of characters in arbitrary strings:    printf "v%vd", $^V;		# prints current version, such as "v5.5.650"    printf "%*vX", ":", $addr;	# formats IPv6 address    printf "%*vb", " ", $bits;	# displays bitstringSee L<perldata/"Scalar value constructors"> for additional information.=head2 Improved Perl version numbering systemBeginning with Perl version 5.6.0, the version number convention has beenchanged to a "dotted integer" scheme that is more commonly found in opensource projects.Maintenance versions of v5.6.0 will be released as v5.6.1, v5.6.2 etc.The next development series following v5.6.0 will be numbered v5.7.x,beginning with v5.7.0, and the next major production release followingv5.6.0 will be v5.8.0.The English module now sets $PERL_VERSION to $^V (a string value) ratherthan C<$]> (a numeric value).  (This is a potential incompatibility.Send us a report via perlbug if you are affected by this.)The v1.2.3 syntax is also now legal in Perl.See L<Support for strings represented as a vector of ordinals> for more on that.To cope with the new versioning system's use of at least three significantdigits for each version component, the method used for incrementing thesubversion number has also changed slightly.  We assume that versions olderthan v5.6.0 have been incrementing the subversion component in multiples of10.  Versions after v5.6.0 will increment them by 1.  Thus, using the newnotation, 5.005_03 is the "same" as v5.5.30, and the first maintenanceversion following v5.6.0 will be v5.6.1 (which should be read as beingequivalent to a floating point value of 5.006_001 in the older format,stored in C<$]>).=head2 New syntax for declaring subroutine attributesFormerly, if you wanted to mark a subroutine as being a method call oras requiring an automatic lock() when it is entered, you had to declarethat with a C<use attrs> pragma in the body of the subroutine.That can now be accomplished with declaration syntax, like this:    sub mymethod : locked method;    ...    sub mymethod : locked method {	...    }    sub othermethod :locked :method;    ...    sub othermethod :locked :method {	...    }(Note how only the first C<:> is mandatory, and whitespace surroundingthe C<:> is optional.)F<AutoSplit.pm> and F<SelfLoader.pm> have been updated to keep the attributeswith the stubs they provide.  See L<attributes>.=head2 File and directory handles can be autovivifiedSimilar to how constructs such as C<< $x->[0] >> autovivify a reference,handle constructors (open(), opendir(), pipe(), socketpair(), sysopen(),socket(), and accept()) now autovivify a file or directory handleif the handle passed to them is an uninitialized scalar variable.  Thisallows the constructs such as C<open(my $fh, ...)> and C<open(local $fh,...)>to be used to create filehandles that will conveniently be closedautomatically when the scope ends, provided there are no other referencesto them.  This largely eliminates the need for typeglobs when openingfilehandles that must be passed around, as in the following example:    sub myopen {        open my $fh, "@_"	     or die "Can't open '@_': $!";	return $fh;    }    {        my $f = myopen("</etc/motd");	print <$f>;	# $f implicitly closed here    }=head2 open() with more than two argumentsIf open() is passed three arguments instead of two, the second argumentis used as the mode and the third argument is taken to be the file name.This is primarily useful for protecting against unintended magic behaviorof the traditional two-argument form.  See L<perlfunc/open>.=head2 64-bit supportAny platform that has 64-bit integers either	(1) natively as longs or ints	(2) via special compiler flags	(3) using long long or int64_tis able to use "quads" (64-bit integers) as follows:=over 4=item *constants (decimal, hexadecimal, octal, binary) in the code =item *arguments to oct() and hex()=item *arguments to print(), printf() and sprintf() (flag prefixes ll, L, q)=item *printed as such=item *pack() and unpack() "q" and "Q" formats=item *in basic arithmetics: + - * / % (NOTE: operating close to the limitsof the integer values may produce surprising results)=item *in bit arithmetics: & | ^ ~ << >> (NOTE: these used to be forced to be 32 bits wide but now operate on the full native width.)=item *vec()=backNote that unless you have the case (a) you will have to configureand compile Perl using the -Duse64bitint Configure flag.    NOTE: The Configure flags -Duselonglong and -Duse64bits have been    deprecated.  Use -Duse64bitint instead.There are actually two modes of 64-bitness: the first one is achievedusing Configure -Duse64bitint and the second one using Configure-Duse64bitall.  The difference is that the first one is minimal andthe second one maximal.  The first works in more places than the second.The C<use64bitint> does only as much as is required to get 64-bitintegers into Perl (this may mean, for example, using "long longs")while your memory may still be limited to 2 gigabytes (because yourpointers could still be 32-bit).  Note that the name C<64bitint> doesnot imply that your C compiler will be using 64-bit C<int>s (it might,but it doesn't have to): the C<use64bitint> means that you will beable to have 64 bits wide scalar values.The C<use64bitall> goes all the way by attempting to switch alsointegers (if it can), longs (and pointers) to being 64-bit.  This maycreate an even more binary incompatible Perl than -Duse64bitint: theresulting executable may not run at all in a 32-bit box, or you mayhave to reboot/reconfigure/rebuild your operating system to be 64-bitaware.Natively 64-bit systems like Alpha and Cray need neither -Duse64bitintnor -Duse64bitall.Last but not least: note that due to Perl's habit of always usingfloating point numbers, the quads are still not true integers.When quads overflow their limits (0...18_446_744_073_709_551_615 unsigned,-9_223_372_036_854_775_808...9_223_372_036_854_775_807 signed), theyare silently promoted to floating point numbers, after which they willstart losing precision (in their lower digits).    NOTE: 64-bit support is still experimental on most platforms.    Existing support only covers the LP64 data model.  In particular, the    LLP64 data model is not yet supported.  64-bit libraries and system    APIs on many platforms have not stabilized--your mileage may vary.=head2 Large file supportIf you have filesystems that support "large files" (files larger than2 gigabytes), you may now also be able to create and access them fromPerl.    NOTE: The default action is to enable large file support, if    available on the platform.If the large file support is on, and you have a Fcntl constantO_LARGEFILE, the O_LARGEFILE is automatically added to the flagsof sysopen().Beware that unless your filesystem also supports "sparse files" seekingto umpteen petabytes may be inadvisable.Note that in addition to requiring a proper file system to do largefiles you may also need to adjust your per-process (or yourper-system, or per-process-group, or per-user-group) maximum filesizelimits before running Perl scripts that try to handle large files,especially if you intend to write such files.Finally, in addition to your process/process group maximum filesizelimits, you may have quota limits on your filesystems that stop you(your user id or your user group id) from using large files.Adjusting your process/user/group/file system/operating system limitsis outside the scope of Perl core language.  For process limits, youmay try increasing the limits using your shell's limits/limit/ulimitcommand before running Perl.  The BSD::Resource extension (notincluded with the standard Perl distribution) may also be of use, itoffers the getrlimit/setrlimit interface that can be used to adjustprocess resource usage limits, including the maximum filesize limit.=head2 Long doublesIn some systems you may be able to use long doubles to enhance therange and precision of your double precision floating point numbers(that is, Perl's numbers).  Use Configure -Duselongdouble to enablethis support (if it is available).=head2 "more bits"You can "Configure -Dusemorebits" to turn on both the 64-bit supportand the long double support.=head2 Enhanced support for sort() subroutinesPerl subroutines with a prototype of C<($$)>, and XSUBs in general, cannow be used as sort subroutines.  In either case, the two elements tobe compared are passed as normal parameters in @_.  See L<perlfunc/sort>.For unprototyped sort subroutines, the historical behavior of passing the elements to be compared as the global variables $a and $b remainsunchanged.=head2 C<sort $coderef @foo> allowedsort() did not accept a subroutine reference as the comparisonfunction in earlier versions.  This is now permitted.

⌨️ 快捷键说明

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