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

📄 perl5004delta.1

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 1
📖 第 1 页 / 共 5 页
字号:
reset when an already-open file handle is reopened with no interveningcall to \f(CW\*(C`close\*(C'\fR.  Due to a bug, perl versions 5.000 through 5.003\&\fIdid\fR reset \f(CW$.\fR under that circumstance; Perl 5.004 does not..ie n .Sh """wantarray"" may return undef".el .Sh "\f(CWwantarray\fP may return undef".IX Subsection "wantarray may return undef"The \f(CW\*(C`wantarray\*(C'\fR operator returns true if a subroutine is expected toreturn a list, and false otherwise.  In Perl 5.004, \f(CW\*(C`wantarray\*(C'\fR canalso return the undefined value if a subroutine's return value willnot be used at all, which allows subroutines to avoid a time-consumingcalculation of a return value if it isn't going to be used..ie n .Sh """eval EXPR"" determines value of \s-1EXPR\s0 in scalar context".el .Sh "\f(CWeval EXPR\fP determines value of \s-1EXPR\s0 in scalar context".IX Subsection "eval EXPR determines value of EXPR in scalar context"Perl (version 5) used to determine the value of \s-1EXPR\s0 inconsistently,sometimes incorrectly using the surrounding context for the determination.Now, the value of \s-1EXPR\s0 (before being parsed by eval) is always determined ina scalar context.  Once parsed, it is executed as before, by providingthe context that the scope surrounding the eval provided.  This changemakes the behavior Perl4 compatible, besides fixing bugs resulting fromthe inconsistent behavior.  This program:.PP.Vb 3\&    @a = qw(time now is time);\&    print eval @a;\&    print \*(Aq|\*(Aq, scalar eval @a;.Ve.PPused to print something like \*(L"timenowis881399109|4\*(R", but now (and in perl4)prints \*(L"4|4\*(R"..Sh "Changes to tainting checks".IX Subsection "Changes to tainting checks"A bug in previous versions may have failed to detect some insecureconditions when taint checks are turned on.  (Taint checks are usedin setuid or setgid scripts, or when explicitly turned on with the\&\f(CW\*(C`\-T\*(C'\fR invocation option.)  Although it's unlikely, this may cause apreviously-working script to now fail \*(-- which should be construedas a blessing, since that indicates a potentially-serious securityhole was just plugged..PPThe new restrictions when tainting include:.IP "No \fIglob()\fR or <*>" 4.IX Item "No glob() or <*>"These operators may spawn the C shell (csh), which cannot be madesafe.  This restriction will be lifted in a future version of Perlwhen globbing is implemented without the use of an external program..ie n .IP "No spawning if tainted $CDPATH\fR, \f(CW$ENV\fR, \f(CW$BASH_ENV" 4.el .IP "No spawning if tainted \f(CW$CDPATH\fR, \f(CW$ENV\fR, \f(CW$BASH_ENV\fR" 4.IX Item "No spawning if tainted $CDPATH, $ENV, $BASH_ENV"These environment variables may alter the behavior of spawned programs(especially shells) in ways that subvert security.  So now they aretreated as dangerous, in the manner of \f(CW$IFS\fR and \f(CW$PATH\fR..ie n .IP "No spawning if tainted $TERM doesn't look like a terminal name" 4.el .IP "No spawning if tainted \f(CW$TERM\fR doesn't look like a terminal name" 4.IX Item "No spawning if tainted $TERM doesn't look like a terminal name"Some termcap libraries do unsafe things with \f(CW$TERM\fR.  However, it would beunnecessarily harsh to treat all \f(CW$TERM\fR values as unsafe, since only shellmetacharacters can cause trouble in \f(CW$TERM\fR.  So a tainted \f(CW$TERM\fR isconsidered to be safe if it contains only alphanumerics, underscores,dashes, and colons, and unsafe if it contains other characters (includingwhitespace)..Sh "New Opcode module and revised Safe module".IX Subsection "New Opcode module and revised Safe module"A new Opcode module supports the creation, manipulation andapplication of opcode masks.  The revised Safe module has a new \s-1API\s0and is implemented using the new Opcode module.  Please read the newOpcode and Safe documentation..Sh "Embedding improvements".IX Subsection "Embedding improvements"In older versions of Perl it was not possible to create more than onePerl interpreter instance inside a single process without leaking like asieve and/or crashing.  The bugs that caused this behavior have all beenfixed.  However, you still must take care when embedding Perl in a Cprogram.  See the updated perlembed manpage for tips on how to manageyour interpreters..Sh "Internal change: FileHandle class based on IO::* classes".IX Subsection "Internal change: FileHandle class based on IO::* classes"File handles are now stored internally as type IO::Handle.  TheFileHandle module is still supported for backwards compatibility, butit is now merely a front end to the IO::* modules \*(-- specifically,IO::Handle, IO::Seekable, and IO::File.  We suggest, but do notrequire, that you use the IO::* modules in new code..PPIn harmony with this change, \f(CW*GLOB{FILEHANDLE}\fR is now just abackward-compatible synonym for \f(CW*GLOB{IO}\fR..Sh "Internal change: PerlIO abstraction interface".IX Subsection "Internal change: PerlIO abstraction interface"It is now possible to build Perl with \s-1AT&T\s0's sfio \s-1IO\s0 packageinstead of stdio.  See perlapio for more details, andthe \fI\s-1INSTALL\s0\fR file for how to use it..Sh "New and changed syntax".IX Subsection "New and changed syntax".ie n .IP "$coderef\->(\s-1PARAMS\s0)" 4.el .IP "\f(CW$coderef\fR\->(\s-1PARAMS\s0)" 4.IX Item "$coderef->(PARAMS)"A subroutine reference may now be suffixed with an arrow and a(possibly empty) parameter list.  This syntax denotes a call of thereferenced subroutine, with the given parameters (if any)..SpThis new syntax follows the pattern of \f(CW\*(C`$hashref\->{FOO}\*(C'\fR and\&\f(CW\*(C`$aryref\->[$foo]\*(C'\fR: You may now write \f(CW\*(C`&$subref($foo)\*(C'\fR as\&\f(CW\*(C`$subref\->($foo)\*(C'\fR.  All these arrow terms may be chained;thus, \f(CW\*(C`&{$table\->{FOO}}($bar)\*(C'\fR may now be written\&\f(CW\*(C`$table\->{FOO}\->($bar)\*(C'\fR..Sh "New and changed builtin constants".IX Subsection "New and changed builtin constants".IP "_\|_PACKAGE_\|_" 4.IX Item "__PACKAGE__"The current package name at compile time, or the undefined value ifthere is no current package (due to a \f(CW\*(C`package;\*(C'\fR directive).  Like\&\f(CW\*(C`_\|_FILE_\|_\*(C'\fR and \f(CW\*(C`_\|_LINE_\|_\*(C'\fR, \f(CW\*(C`_\|_PACKAGE_\|_\*(C'\fR does \fInot\fR interpolateinto strings..Sh "New and changed builtin variables".IX Subsection "New and changed builtin variables".IP "$^E" 4.IX Item "$^E"Extended error message on some platforms.  (Also known as\&\f(CW$EXTENDED_OS_ERROR\fR if you \f(CW\*(C`use English\*(C'\fR)..IP "$^H" 4.IX Item "$^H"The current set of syntax checks enabled by \f(CW\*(C`use strict\*(C'\fR.  See thedocumentation of \f(CW\*(C`strict\*(C'\fR for more details.  Not actually new, butnewly documented.Because it is intended for internal use by Perl core components,there is no \f(CW\*(C`use English\*(C'\fR long name for this variable..IP "$^M" 4.IX Item "$^M"By default, running out of memory it is not trappable.  However, ifcompiled for this, Perl may use the contents of \f(CW$^M\fR as an emergencypool after \fIdie()\fRing with this message.  Suppose that your Perl werecompiled with \-DPERL_EMERGENCY_SBRK and used Perl's malloc.  Then.Sp.Vb 1\&    $^M = \*(Aqa\*(Aq x (1<<16);.Ve.Spwould allocate a 64K buffer for use when in emergency.See the \fI\s-1INSTALL\s0\fR file for information on how to enable this option.As a disincentive to casual use of this advanced feature,there is no \f(CW\*(C`use English\*(C'\fR long name for this variable..Sh "New and changed builtin functions".IX Subsection "New and changed builtin functions".IP "delete on slices" 4.IX Item "delete on slices"This now works.  (e.g. \f(CW\*(C`delete @ENV{\*(AqPATH\*(Aq, \*(AqMANPATH\*(Aq}\*(C'\fR).IP "flock" 4.IX Item "flock"is now supported on more platforms, prefers fcntl to lockf whenemulating, and always flushes before (un)locking..IP "printf and sprintf" 4.IX Item "printf and sprintf"Perl now implements these functions itself; it doesn't use the Clibrary function \fIsprintf()\fR any more, except for floating-pointnumbers, and even then only known flags are allowed.  As a result, itis now possible to know which conversions and flags will work, andwhat they will do..SpThe new conversions in Perl's \fIsprintf()\fR are:.Sp.Vb 4\&   %i   a synonym for %d\&   %p   a pointer (the address of the Perl value, in hexadecimal)\&   %n   special: *stores* the number of characters output so far\&        into the next variable in the parameter list.Ve.SpThe new flags that go between the \f(CW\*(C`%\*(C'\fR and the conversion are:.Sp.Vb 3\&   #    prefix octal with "0", hex with "0x"\&   h    interpret integer as C type "short" or "unsigned short"\&   V    interpret integer as Perl\*(Aqs standard integer type.Ve.SpAlso, where a number would appear in the flags, an asterisk (\*(L"*\*(R") maybe used instead, in which case Perl uses the next item in theparameter list as the given number (that is, as the field width orprecision).  If a field width obtained through \*(L"*\*(R" is negative, it hasthe same effect as the '\-' flag: left-justification..SpSee \*(L"sprintf\*(R" in perlfunc for a complete list of conversion and flags..IP "keys as an lvalue" 4.IX Item "keys as an lvalue"As an lvalue, \f(CW\*(C`keys\*(C'\fR allows you to increase the number of hash bucketsallocated for the given hash.  This can gain you a measure of efficiency ifyou know the hash is going to get big.  (This is similar to pre-extendingan array by assigning a larger number to $#array.)  If you say.Sp.Vb 1\&    keys %hash = 200;.Ve.Spthen \f(CW%hash\fR will have at least 200 buckets allocated for it.  Thesebuckets will be retained even if you do \f(CW\*(C`%hash = ()\*(C'\fR; use \f(CW\*(C`undef%hash\*(C'\fR if you want to free the storage while \f(CW%hash\fR is still in scope.You can't shrink the number of buckets allocated for the hash using\&\f(CW\*(C`keys\*(C'\fR in this way (but you needn't worry about doing this by accident,as trying has no effect)..IP "\fImy()\fR in Control Structures" 4.IX Item "my() in Control Structures"You can now use \fImy()\fR (with or without the parentheses) in the controlexpressions of control structures such as:.Sp.Vb 5\&    while (defined(my $line = <>)) {\&        $line = lc $line;\&    } continue {\&        print $line;\&    }\&\&    if ((my $answer = <STDIN>) =~ /^y(es)?$/i) {\&        user_agrees();\&    } elsif ($answer =~ /^n(o)?$/i) {\&        user_disagrees();\&    } else {\&        chomp $answer;\&        die "\`$answer\*(Aq is neither \`yes\*(Aq nor \`no\*(Aq";\&    }.Ve.SpAlso, you can declare a foreach loop control variable as lexical bypreceding it with the word \*(L"my\*(R".  For example, in:.Sp.Vb 3\&    foreach my $i (1, 2, 3) {\&        some_function();\&    }.Ve.Sp\&\f(CW$i\fR is a lexical variable, and the scope of \f(CW$i\fR extends to the end ofthe loop, but not beyond it..SpNote that you still cannot use \fImy()\fR on global punctuation variablessuch as \f(CW$_\fR and the like..IP "\fIpack()\fR and \fIunpack()\fR" 4.IX Item "pack() and unpack()"A new format 'w' represents a \s-1BER\s0 compressed integer (as defined in\&\s-1ASN\s0.1).  Its format is a sequence of one or more bytes, each of whichprovides seven bits of the total value, with the most significantfirst.  Bit eight of each byte is set, except for the last byte, inwhich bit eight is clear..SpIf 'p' or 'P' are given undef as values, they now generate a \s-1NULL\s0pointer..SpBoth \fIpack()\fR and \fIunpack()\fR now fail when their templates contain invalidtypes.  (Invalid types used to be ignored.).IP "\fIsysseek()\fR" 4.IX Item "sysseek()"The new \fIsysseek()\fR operator is a variant of \fIseek()\fR that sets and gets thefile's system read/write position, using the \fIlseek\fR\|(2) system call.  It isthe only reliable way to seek before using \fIsysread()\fR or \fIsyswrite()\fR.  Itsreturn value is the new position, or the undefined value on failure..IP "use \s-1VERSION\s0" 4.IX Item "use VERSION"If the first argument to \f(CW\*(C`use\*(C'\fR is a number, it is treated as a versionnumber instead of a module name.  If the version of the Perl interpreteris less than \s-1VERSION\s0, then an error message is printed and Perl exitsimmediately.  Because \f(CW\*(C`use\*(C'\fR occurs at compile time, this check happensimmediately during the compilation process, unlike \f(CW\*(C`require VERSION\*(C'\fR,which waits until runtime for the check.  This is often useful if youneed to check the current Perl version before \f(CW\*(C`use\*(C'\fRing library moduleswhich have changed in incompatible ways from older versions of Perl.(We try not to do this more than we have to.).IP "use Module \s-1VERSION\s0 \s-1LIST\s0" 4.IX Item "use Module VERSION LIST"If the \s-1VERSION\s0 argument is present between Module and \s-1LIST\s0, then the\&\f(CW\*(C`use\*(C'\fR will call the \s-1VERSION\s0 method in class Module with the givenversion as an argument.  The default \s-1VERSION\s0 method, inherited fromthe \s-1UNIVERSAL\s0 class, croaks if the given version is larger than thevalue of the variable \f(CW$Module::VERSION\fR.  (Note that there is not acomma after \s-1VERSION\s0!).SpThis version-checking mechanism is similar to the one currently usedin the Exporter module, but it is faster and can be used with modulesthat don't use the Exporter.  It is the recommended method for newcode..IP "prototype(\s-1FUNCTION\s0)" 4.IX Item "prototype(FUNCTION)"Returns the prototype of a function as a string (or \f(CW\*(C`undef\*(C'\fR if thefunction has no prototype).  \s-1FUNCTION\s0 is a reference to or the name of thefunction whose prototype you want to retrieve.(Not actually new; just never documented before.).IP "srand" 4.IX Item "srand"The default seed for \f(CW\*(C`srand\*(C'\fR, which used to be \f(CW\*(C`time\*(C'\fR, has been changed.Now it's a heady mix of difficult-to-predict system-dependent values,which should be sufficient for most everyday purposes..SpPrevious to version 5.004, calling \f(CW\*(C`rand\*(C'\fR without first calling \f(CW\*(C`srand\*(C'\fRwould yield the same sequence of random numbers on most or all machines.Now, when perl sees that you're calling \f(CW\*(C`rand\*(C'\fR and haven't yet called\&\f(CW\*(C`srand\*(C'\fR, it calls \f(CW\*(C`srand\*(C'\fR with the default seed. You should still call\&\f(CW\*(C`srand\*(C'\fR manually if your code might ever be run on a pre\-5.004 system,of course, or if you want a seed other than the default..ie n .IP "$_ as Default" 4

⌨️ 快捷键说明

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