X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperllexwarn.pod;h=20f1875c0cbd18857e603ac62369e2539e034fb9;hb=058cbdf29801a8d93ccfce9e13fe10af6f37109c;hp=8274c4d70ee05311ee0dc95ddbe1f6c7fd59ee74;hpb=d74e8afc9309529cf5c6c4390fc311850865d506;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perllexwarn.pod b/pod/perllexwarn.pod index 8274c4d..20f1875 100644 --- a/pod/perllexwarn.pod +++ b/pod/perllexwarn.pod @@ -20,21 +20,21 @@ doesn't attempt to control the warnings will work unchanged. All warnings are enabled in a block by either of these: - use warnings ; - use warnings 'all' ; + use warnings; + use warnings 'all'; Similarly all warnings are disabled in a block by either of these: - no warnings ; - no warnings 'all' ; + no warnings; + no warnings 'all'; For example, consider the code below: - use warnings ; - my @a ; + use warnings; + my @a; { - no warnings ; - my $b = @a[0] ; + no warnings; + my $b = @a[0]; } my $c = @a[0]; @@ -63,7 +63,7 @@ example, in the code below, an C<"isn't numeric"> warning will only be reported for the C<$a> variable. my $a = "2:" + 3; - no warnings ; + no warnings; my $b = "2:" + 3; Note that neither the B<-w> flag or the C<$^W> can be used to @@ -83,9 +83,9 @@ 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 ; - my $a =+ 2 ; - my $b ; chop $b ; + local ($^W) = 0; + my $a =+ 2; + my $b; chop $b; } When this code is run with the B<-w> flag, a warning will be produced @@ -96,8 +96,8 @@ disable compile-time warnings you need to rewrite the code like this: { BEGIN { $^W = 0 } - my $a =+ 2 ; - my $b ; chop $b ; + my $a =+ 2; + my $b; chop $b; } The other big problem with C<$^W> is the way you can inadvertently @@ -108,13 +108,13 @@ the first will not. sub doit { - my $b ; chop $b ; + my $b; chop $b; } - doit() ; + doit(); { - local ($^W) = 1 ; + local ($^W) = 1; doit() } @@ -306,17 +306,17 @@ The current hierarchy is: Just like the "strict" pragma any of these categories can be combined - use warnings qw(void redefine) ; - no warnings qw(io syntax untie) ; + use warnings qw(void redefine); + no warnings qw(io syntax untie); Also like the "strict" pragma, if there is more than one instance of the C pragma in a given scope the cumulative effect is additive. - use warnings qw(void) ; # only "void" warnings enabled + use warnings qw(void); # only "void" warnings enabled ... - use warnings qw(io) ; # only "void" & "io" warnings enabled + use warnings qw(io); # only "void" & "io" warnings enabled ... - no warnings qw(void) ; # only "io" warnings enabled + no warnings qw(void); # only "io" warnings enabled To determine which category a specific warning has been assigned to see L. @@ -335,18 +335,18 @@ into fatal errors. In the code below, the use of C