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

📄 perllexwarn.1

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 1
📖 第 1 页 / 共 2 页
字号:
.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05).\".\" Standard preamble:.\" ========================================================================.de Sh \" Subsection heading.br.if t .Sp.ne 5.PP\fB\\$1\fR.PP...de Sp \" Vertical space (when we can't use .PP).if t .sp .5v.if n .sp...de Vb \" Begin verbatim text.ft CW.nf.ne \\$1...de Ve \" End verbatim text.ft R.fi...\" Set up some character translations and predefined strings.  \*(-- will.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left.\" double quote, and \*(R" will give a right double quote.  \*(C+ will.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,.\" nothing in troff, for use with C<>..tr \(*W-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'.ie n \{\.    ds -- \(*W-.    ds PI pi.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch.    ds L" "".    ds R" "".    ds C` "".    ds C' ""'br\}.el\{\.    ds -- \|\(em\|.    ds PI \(*p.    ds L" ``.    ds R" '''br\}.\".\" Escape single quotes in literal strings from groff's Unicode transform..ie \n(.g .ds Aq \(aq.el       .ds Aq '.\".\" If the F register is turned on, we'll generate index entries on stderr for.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index.\" entries marked with X<> in POD.  Of course, you'll have to process the.\" output yourself in some meaningful fashion..ie \nF \{\.    de IX.    tm Index:\\$1\t\\n%\t"\\$2"...    nr % 0.    rr F.\}.el \{\.    de IX...\}.\".\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2)..\" Fear.  Run.  Save yourself.  No user-serviceable parts..    \" fudge factors for nroff and troff.if n \{\.    ds #H 0.    ds #V .8m.    ds #F .3m.    ds #[ \f1.    ds #] \fP.\}.if t \{\.    ds #H ((1u-(\\\\n(.fu%2u))*.13m).    ds #V .6m.    ds #F 0.    ds #[ \&.    ds #] \&.\}.    \" simple accents for nroff and troff.if n \{\.    ds ' \&.    ds ` \&.    ds ^ \&.    ds , \&.    ds ~ ~.    ds /.\}.if t \{\.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u".    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'.\}.    \" troff and (daisy-wheel) nroff accents.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'.ds 8 \h'\*(#H'\(*b\h'-\*(#H'.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#].ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#].ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#].ds ae a\h'-(\w'a'u*4/10)'e.ds Ae A\h'-(\w'A'u*4/10)'E.    \" corrections for vroff.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'.    \" for low resolution devices (crt and lpr).if \n(.H>23 .if \n(.V>19 \\{\.    ds : e.    ds 8 ss.    ds o a.    ds d- d\h'-1'\(ga.    ds D- D\h'-1'\(hy.    ds th \o'bp'.    ds Th \o'LP'.    ds ae ae.    ds Ae AE.\}.rm #[ #] #H #V #F C.\" ========================================================================.\".IX Title "PERLLEXWARN 1".TH PERLLEXWARN 1 "2007-12-18" "perl v5.10.0" "Perl Programmers Reference Guide".\" For nroff, turn off justification.  Always turn off hyphenation; it makes.\" way too many mistakes in technical documents..if n .ad l.nh.SH "NAME"perllexwarn \- Perl Lexical Warnings.IX Xref "warning, lexical warnings warning".SH "DESCRIPTION".IX Header "DESCRIPTION"The \f(CW\*(C`use warnings\*(C'\fR pragma enables to control precisely what warnings areto be enabled in which parts of a Perl program. It's a more flexiblealternative for both the command line flag \fB\-w\fR and the equivalent Perlvariable, \f(CW$^W\fR..PPThis pragma works just like the \f(CW\*(C`strict\*(C'\fR pragma.This means that the scope of the warning pragma is limited to theenclosing block. It also means that the pragma setting will notleak across files (via \f(CW\*(C`use\*(C'\fR, \f(CW\*(C`require\*(C'\fR or \f(CW\*(C`do\*(C'\fR). This allowsauthors to independently define the degree of warning checks that willbe applied to their module..PPBy default, optional warnings are disabled, so any legacy code thatdoesn't attempt to control the warnings will work unchanged..PPAll warnings are enabled in a block by either of these:.PP.Vb 2\&    use warnings;\&    use warnings \*(Aqall\*(Aq;.Ve.PPSimilarly all warnings are disabled in a block by either of these:.PP.Vb 2\&    no warnings;\&    no warnings \*(Aqall\*(Aq;.Ve.PPFor example, consider the code below:.PP.Vb 7\&    use warnings;\&    my @a;\&    {\&        no warnings;\&        my $b = @a[0];\&    }\&    my $c = @a[0];.Ve.PPThe code in the enclosing block has warnings enabled, but the innerblock has them disabled. In this case that means the assignment to thescalar \f(CW$c\fR will trip the \f(CW"Scalar value @a[0] better written as $a[0]"\fRwarning, but the assignment to the scalar \f(CW$b\fR will not..Sh "Default Warnings and Optional Warnings".IX Subsection "Default Warnings and Optional Warnings"Before the introduction of lexical warnings, Perl had two classes ofwarnings: mandatory and optional..PPAs its name suggests, if your code tripped a mandatory warning, youwould get a warning whether you wanted it or not.For example, the code below would always produce an \f(CW"isn\*(Aqt numeric"\fRwarning about the \*(L"2:\*(R"..PP.Vb 1\&    my $a = "2:" + 3;.Ve.PPWith the introduction of lexical warnings, mandatory warnings now become\&\fIdefault\fR warnings. The difference is that although the previouslymandatory warnings are still enabled by default, they can then besubsequently enabled or disabled with the lexical warning pragma. Forexample, in the code below, an \f(CW"isn\*(Aqt numeric"\fR warning will onlybe reported for the \f(CW$a\fR variable..PP.Vb 3\&    my $a = "2:" + 3;\&    no warnings;\&    my $b = "2:" + 3;.Ve.PPNote that neither the \fB\-w\fR flag or the \f(CW$^W\fR can be used todisable/enable default warnings. They are still mandatory in this case..ie n .Sh "What's wrong with \fB\-w\fP and $^W".el .Sh "What's wrong with \fB\-w\fP and \f(CW$^W\fP".IX Subsection "What's wrong with -w and $^W"Although very useful, the big problem with using \fB\-w\fR on the commandline to enable warnings is that it is all or nothing. Take the typicalscenario when you are writing a Perl program. Parts of the code youwill write yourself, but it's very likely that you will make use ofpre-written Perl modules. If you use the \fB\-w\fR flag in this case, youend up enabling warnings in pieces of code that you haven't written..PPSimilarly, using \f(CW$^W\fR to either disable or enable blocks of code isfundamentally flawed. For a start, say you want to disable warnings ina block of code. You might expect this to be enough to do the trick:.PP.Vb 5\&     {\&         local ($^W) = 0;\&         my $a =+ 2;\&         my $b; chop $b;\&     }.Ve.PPWhen this code is run with the \fB\-w\fR flag, a warning will be producedfor the \f(CW$a\fR line \*(-- \f(CW"Reversed += operator"\fR..PPThe problem is that Perl has both compile-time and run-time warnings. Todisable compile-time warnings you need to rewrite the code like this:.PP.Vb 5\&     {\&         BEGIN { $^W = 0 }\&         my $a =+ 2;\&         my $b; chop $b;\&     }.Ve.PPThe other big problem with \f(CW$^W\fR is the way you can inadvertentlychange the warning setting in unexpected places in your code. For example,when the code below is run (without the \fB\-w\fR flag), the second callto \f(CW\*(C`doit\*(C'\fR will trip a \f(CW"Use of uninitialized value"\fR warning, whereasthe first will not..PP.Vb 4\&    sub doit\&    {\&        my $b; chop $b;\&    }\&\&    doit();\&\&    {\&        local ($^W) = 1;\&        doit()\&    }.Ve.PPThis is a side-effect of \f(CW$^W\fR being dynamically scoped..PPLexical warnings get around these limitations by allowing finer controlover where warnings can or can't be tripped..Sh "Controlling Warnings from the Command Line".IX Subsection "Controlling Warnings from the Command Line"There are three Command Line flags that can be used to control whenwarnings are (or aren't) produced:.IP "\fB\-w\fR" 5.IX Xref "-w".IX Item "-w"This is  the existing flag. If the lexical warnings pragma is \fBnot\fRused in any of you code, or any of the modules that you use, this flagwill enable warnings everywhere. See \*(L"Backward Compatibility\*(R" fordetails of how this flag interacts with lexical warnings..IP "\fB\-W\fR" 5.IX Xref "-W".IX Item "-W"If the \fB\-W\fR flag is used on the command line, it will enable all warningsthroughout the program regardless of whether warnings were disabledlocally using \f(CW\*(C`no warnings\*(C'\fR or \f(CW\*(C`$^W =0\*(C'\fR. This includes all files that getincluded via \f(CW\*(C`use\*(C'\fR, \f(CW\*(C`require\*(C'\fR or \f(CW\*(C`do\*(C'\fR.Think of it as the Perl equivalent of the \*(L"lint\*(R" command..IP "\fB\-X\fR" 5.IX Xref "-X".IX Item "-X"Does the exact opposite to the \fB\-W\fR flag, i.e. it disables all warnings..Sh "Backward Compatibility".IX Subsection "Backward Compatibility"If you are used with working with a version of Perl prior to theintroduction of lexically scoped warnings, or have code that uses bothlexical warnings and \f(CW$^W\fR, this section will describe how they interact..PPHow Lexical Warnings interact with \fB\-w\fR/\f(CW$^W\fR:.IP "1." 5If none of the three command line flags (\fB\-w\fR, \fB\-W\fR or \fB\-X\fR) thatcontrol warnings is used and neither \f(CW$^W\fR or the \f(CW\*(C`warnings\*(C'\fR pragmaare used, then default warnings will be enabled and optional warningsdisabled.This means that legacy code that doesn't attempt to control the warningswill work unchanged..IP "2." 5The \fB\-w\fR flag just sets the global \f(CW$^W\fR variable as in 5.005 \*(-- thismeans that any legacy code that currently relies on manipulating \f(CW$^W\fRto control warning behavior will still work as is..IP "3." 5Apart from now being a boolean, the \f(CW$^W\fR variable operates in exactlythe same horrible uncontrolled global way, except that it cannotdisable/enable default warnings..IP "4." 5If a piece of code is under the control of the \f(CW\*(C`warnings\*(C'\fR pragma,both the \f(CW$^W\fR variable and the \fB\-w\fR flag will be ignored for thescope of the lexical warning..IP "5." 5The only way to override a lexical warnings setting is with the \fB\-W\fRor \fB\-X\fR command line flags..PPThe combined effect of 3 & 4 is that it will allow code which usesthe \f(CW\*(C`warnings\*(C'\fR pragma to control the warning behavior of $^W\-typecode (using a \f(CW\*(C`local $^W=0\*(C'\fR) if it really wants to, but not vice-versa..Sh "Category Hierarchy".IX Xref "warning, categories".IX Subsection "Category Hierarchy"A hierarchy of \*(L"categories\*(R" have been defined to allow groups of warningsto be enabled/disabled in isolation..PP

⌨️ 快捷键说明

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