This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #126051] make the warnings::enabled example use warnings::enabled
authorTony Cook <tony@develop-help.com>
Mon, 14 Sep 2015 04:32:07 +0000 (14:32 +1000)
committerTony Cook <tony@develop-help.com>
Mon, 12 Oct 2015 03:55:52 +0000 (14:55 +1100)
7e6d00f88633 added the warnif() function and changed most uses of
warnings:enabled() to use warnif(), including this one.  Revert
just that part.

lib/warnings.pm
regen/warnings.pl

index ba466a8..8d94724 100644 (file)
@@ -1015,8 +1015,10 @@ this snippet of code:
     package MyMod::Abc;
 
     sub open {
-        warnings::warnif("deprecated",
-                         "open is deprecated, use new instead");
+        if (warnings::enabled("deprecated")) {
+            warnings::warn("deprecated",
+                           "open is deprecated, use new instead");
+        }
         new(@_);
     }
 
index 6a07493..18f337e 100644 (file)
@@ -1144,8 +1144,10 @@ this snippet of code:
     package MyMod::Abc;
 
     sub open {
-        warnings::warnif("deprecated",
-                         "open is deprecated, use new instead");
+        if (warnings::enabled("deprecated")) {
+            warnings::warn("deprecated",
+                           "open is deprecated, use new instead");
+        }
         new(@_);
     }