-
Notifications
You must be signed in to change notification settings - Fork 550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
warnings man page: 'enabled' has example for warnif #14905
Comments
From perl-diddler@tlinx.orgCreated by perl-diddler@tlinx.orgThe library module, "warnings" shows an example for 'warnif' [quote] package MyMod::Abc; sub open { Perl Info
|
From @tonycozOn Sun Sep 13 17:18:03 2015, LAWalsh wrote:
It looks like this was changed by mistake in 7e6d00f which introduced warnings::warnif() and changed most uses of warnings::enabled() in core to use warnings::warnig(), including this one. I've attached two patches, one to sync the $VERSION of regen/warnings.pl and lib/warnings.pm, since the first generates the second, and two to partly revert the change to the example. Tony |
From @tonycoz0001-sync-regen-warnings.pl-and-warnings.pm-VERSION.patchFrom 1489b6f27cfc1b1e6b26d118593007d6a69e95ca Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Mon, 14 Sep 2015 14:31:43 +1000
Subject: sync regen/warnings.pl and warnings.pm $VERSION
regen/warnings.pl's $VERSION was at 1.04 despite it being modified
each time warnings.pm is modified.
So make them use the same version number.
---
lib/warnings.pm | 2 +-
regen/warnings.pl | 11 +++++++++--
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/lib/warnings.pm b/lib/warnings.pm
index 332f7c1..3c31b60 100644
--- a/lib/warnings.pm
+++ b/lib/warnings.pm
@@ -5,7 +5,7 @@
package warnings;
-our $VERSION = '1.33';
+our $VERSION = "1.34";
# Verify that we're called correctly so that warnings will work.
# see also strict.pm.
diff --git a/regen/warnings.pl b/regen/warnings.pl
index c4cc19c..0549af4 100644
--- a/regen/warnings.pl
+++ b/regen/warnings.pl
@@ -16,7 +16,7 @@
#
# This script is normally invoked from regen.pl.
-$VERSION = '1.03';
+$VERSION = '1.34';
BEGIN {
require 'regen/regen_lib.pl';
@@ -416,6 +416,13 @@ EOM
}
while (<DATA>) {
+ last if /^VERSION$/ ;
+ print $pm $_ ;
+}
+
+print $pm qq(our \$VERSION = "$::VERSION";\n);
+
+while (<DATA>) {
last if /^KEYWORDS$/ ;
print $pm $_ ;
}
@@ -481,7 +488,7 @@ read_only_bottom_close_and_rename($pm);
__END__
package warnings;
-our $VERSION = '1.33';
+VERSION
# Verify that we're called correctly so that warnings will work.
# see also strict.pm.
--
2.1.4
|
From @tonycoz0002-perl-126051-make-the-warnings-enabled-example-use-wa.patchFrom 5df471f553fe1018fa6cdccc91ae55835f4af26b Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Mon, 14 Sep 2015 14:32:07 +1000
Subject: [perl #126051] make the warnings::enabled example use
warnings::enabled
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 | 6 ++++--
regen/warnings.pl | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/lib/warnings.pm b/lib/warnings.pm
index 3c31b60..9cc6e19 100644
--- a/lib/warnings.pm
+++ b/lib/warnings.pm
@@ -1020,8 +1020,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(@_);
}
diff --git a/regen/warnings.pl b/regen/warnings.pl
index 0549af4..d8006be 100644
--- a/regen/warnings.pl
+++ b/regen/warnings.pl
@@ -1146,8 +1146,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(@_);
}
--
2.1.4
|
The RT System itself - Status changed from 'new' to 'open' |
From @jkeenanOn Sun Sep 13 21:35:47 2015, tonyc wrote:
+1 -- |
From @tonycozOn Sun Sep 13 21:35:47 2015, tonyc wrote:
Applied as 3d8ff82 and 4a21999, though I had to bump the version again. Tony |
@tonycoz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#126051 (status was 'resolved')
Searchable as RT126051$
The text was updated successfully, but these errors were encountered: