X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperllexwarn.pod;h=12ce1f6c82ece36aa5f7e2d8f5bc97e343163918;hb=28b41a8090d259cff9b1dd87c0c53b3c4a31e822;hp=450838737cb720f1677dedfaf4ca36ae970604ae;hpb=3eae5ce4a4b90029f63b3704e1e4f298978a360c;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perllexwarn.pod b/pod/perllexwarn.pod index 4508387..12ce1f6 100644 --- a/pod/perllexwarn.pod +++ b/pod/perllexwarn.pod @@ -207,8 +207,12 @@ The current hierarchy is: all -+ | + +- assertions + | +- closure | + +- deprecated + | +- exiting | +- glob @@ -219,6 +223,8 @@ The current hierarchy is: | | | +- exec | | + | +- layer + | | | +- newline | | | +- pipe @@ -263,8 +269,6 @@ The current hierarchy is: | | | +- bareword | | - | +- deprecated - | | | +- digit | | | +- parenthesis @@ -283,6 +287,8 @@ The current hierarchy is: | +- taint | + +- threads + | +- uninitialized | +- unpack @@ -312,6 +318,11 @@ C pragma in a given scope the cumulative effect is additive. 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 +in its own right. + + =head2 Fatal Warnings The presence of the word "FATAL" in the category list will escalate any @@ -342,6 +353,19 @@ The scope where C is used has escalated the C warnings category into a fatal error, so the program terminates immediately it encounters the warning. +To explicitly turn off a "FATAL" warning you just disable the warning +it is associated with. So, for example, to disable the "void" warning +in the example above, either of these will do the trick: + + no warnings qw(void); + no warnings FATAL => qw(void); + +If you want to downgrade a warning that has been escalated into a fatal +error back to a normal warning, you can use the "NONFATAL" keyword. For +example, the code below will promote all warnings into fatal errors, +except for those in the "syntax" category. + + use warnings FATAL => 'all', NONFATAL => 'syntax'; =head2 Reporting Warnings from a Module @@ -358,9 +382,10 @@ Consider the module C below. sub open { my $path = shift ; - if (warnings::enabled() && $path !~ m#^/#) { - warnings::warn("changing relative path to /tmp/"); - $path = "/tmp/$path" ; + if ($path !~ m#^/#) { + warnings::warn("changing relative path to /var/abc") + if warnings::enabled(); + $path = "/var/abc/$path"; } }