From: Father Chrysostomos Date: Thu, 31 Oct 2013 12:52:24 +0000 (-0700) Subject: perllexwarn: consistent spaces after dots X-Git-Tag: upstream/5.20.0~1411 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=598bcb826253d06467481559a50ababf94179559;p=platform%2Fupstream%2Fperl.git perllexwarn: consistent spaces after dots --- diff --git a/pod/perllexwarn.pod b/pod/perllexwarn.pod index d632920..0c849a4 100644 --- a/pod/perllexwarn.pod +++ b/pod/perllexwarn.pod @@ -6,14 +6,14 @@ perllexwarn - Perl Lexical Warnings =head1 DESCRIPTION The C pragma enables to control precisely what warnings are -to be enabled in which parts of a Perl program. It's a more flexible +to be enabled in which parts of a Perl program. It's a more flexible alternative for both the command line flag B<-w> and the equivalent Perl variable, C<$^W>. This pragma works just like the C pragma. This means that the scope of the warning pragma is limited to the -enclosing block. It also means that the pragma setting will not -leak across files (via C, C or C). This allows +enclosing block. It also means that the pragma setting will not +leak across files (via C, C or C). This allows authors to independently define the degree of warning checks that will be applied to their module. @@ -41,7 +41,7 @@ For example, consider the code below: my $c = @a[0]; The code in the enclosing block has warnings enabled, but the inner -block has them disabled. In this case that means the assignment to the +block has them disabled. In this case that means the assignment to the scalar C<$c> will trip the C<"Scalar value @a[0] better written as $a[0]"> warning, but the assignment to the scalar C<$b> will not. @@ -58,9 +58,9 @@ warning about the "2:". my $a = "2:" + 3; With the introduction of lexical warnings, mandatory warnings now become -I warnings. The difference is that although the previously +I warnings. The difference is that although the previously mandatory warnings are still enabled by default, they can then be -subsequently enabled or disabled with the lexical warning pragma. For +subsequently enabled or disabled with the lexical warning pragma. For example, in the code below, an C<"isn't numeric"> warning will only be reported for the C<$a> variable. @@ -69,20 +69,20 @@ be reported for the C<$a> variable. my $b = "2:" + 3; Note that neither the B<-w> flag or the C<$^W> can be used to -disable/enable default warnings. They are still mandatory in this case. +disable/enable default warnings. They are still mandatory in this case. =head2 What's wrong with B<-w> and C<$^W> Although very useful, the big problem with using B<-w> on the command -line to enable warnings is that it is all or nothing. Take the typical -scenario when you are writing a Perl program. Parts of the code you +line to enable warnings is that it is all or nothing. Take the typical +scenario when you are writing a Perl program. Parts of the code you will write yourself, but it's very likely that you will make use of -pre-written Perl modules. If you use the B<-w> flag in this case, you +pre-written Perl modules. If you use the B<-w> flag in this case, you end up enabling warnings in pieces of code that you haven't written. Similarly, using C<$^W> to either disable or enable blocks of code is -fundamentally flawed. For a start, say you want to disable warnings in -a block of code. You might expect this to be enough to do the trick: +fundamentally flawed. For a start, say you want to disable warnings in +a block of code. You might expect this to be enough to do the trick: { local ($^W) = 0; @@ -93,7 +93,7 @@ a block of code. You might expect this to be enough to do the trick: When this code is run with the B<-w> flag, a warning will be produced for the C<$a> line: C<"Reversed += operator">. -The problem is that Perl has both compile-time and run-time warnings. To +The problem is that Perl has both compile-time and run-time warnings. To disable compile-time warnings you need to rewrite the code like this: { @@ -103,7 +103,7 @@ disable compile-time warnings you need to rewrite the code like this: } The other big problem with C<$^W> is the way you can inadvertently -change the warning setting in unexpected places in your code. For example, +change the warning setting in unexpected places in your code. For example, when the code below is run (without the B<-w> flag), the second call to C will trip a C<"Use of uninitialized value"> warning, whereas the first will not. @@ -135,9 +135,9 @@ warnings are (or aren't) produced: =item B<-w> X<-w> -This is the existing flag. If the lexical warnings pragma is B +This is the existing flag. If the lexical warnings pragma is B used in any of you code, or any of the modules that you use, this flag -will enable warnings everywhere. See L for +will enable warnings everywhere. See L for details of how this flag interacts with lexical warnings. =item B<-W> @@ -145,7 +145,8 @@ X<-W> If the B<-W> flag is used on the command line, it will enable all warnings throughout the program regardless of whether warnings were disabled -locally using C or C<$^W =0>. This includes all files that get +locally using C or C<$^W =0>. +This includes all files that get included via C, C or C. Think of it as the Perl equivalent of the "lint" command. @@ -177,7 +178,7 @@ will work unchanged. =item 2. -The B<-w> flag just sets the global C<$^W> variable as in 5.005. This +The B<-w> flag just sets the global C<$^W> variable as in 5.005. This means that any legacy code that currently relies on manipulating C<$^W> to control warning behavior will still work as is. @@ -354,7 +355,7 @@ To determine which category a specific warning has been assigned to see L. Note: In Perl 5.6.1, the lexical warnings category "deprecated" was a -sub-category of the "syntax" category. It is now a top-level category +sub-category of the "syntax" category. It is now a top-level category in its own right. =head2 Fatal Warnings @@ -362,7 +363,7 @@ X The presence of the word "FATAL" in the category list will escalate any warnings detected from the categories specified in the lexical scope -into fatal errors. In the code below, the use of C