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
diagnostics.pm suppresses 'Use of uninitialized value in range (or flip)' warning #10017
Comments
From Gene.Sullivan@mediatek.comBug Summarydiagnostics.pm suppresses the following type of warning EvidenceHere, we get the warning message, as expected: Now, add diagnostics to get a more verbose explanation There are two problems: A third problem occurs if diagnostics is used in conjunction with The problem occurs under both methods of using diagnostics: When diagnostics.pm is used with warnings.pm, we expect to get more $ echo 'Use of uninitialized value in range (or flip)' | splain To help you figure out what was undefined, perl tells you what operation PatchThe problem is fixed by adding the following line to diagnostics.pm: This is the patch (diff -u): Inline Patch--- diagnostics.pm 2009-06-15 04:21:42.000000000 -0400
+++ diagnostics.pm.fix 2009-12-05 10:29:53.096561000 -0500
@@ -222,6 +222,7 @@
local $| = 1;
my $_;
+local $.;
my $standalone;
my(%HTML_2_Troff, %HTML_2_Latin_1, %HTML_2_ASCII_7);
Inline Patch--- splain 2009-06-15 04:21:43.000000000 -0400
+++ splain.fix 2009-12-09 11:06:43.570183000 -0500
@@ -224,6 +224,7 @@
local $| = 1;
my $_;
+local $.;
my $standalone;
my(%HTML_2_Troff, %HTML_2_Latin_1, %HTML_2_ASCII_7);
This test should fail on the current diagnostics.pm, use warnings; use diagnostics; VersionThe $VERSION of diagnostics.pm I have installed is 1.17. Root CauseHere is my hypothesis on why this happens. This is a quote from perlop#Range-Operator: By default, $. is undefined: But, when you use [doc://diagnostics], $. becomes defined: So, it seems that diagnostics has the side effect Perl Info
|
From @ikegamiOn Fri, Dec 11, 2009 at 12:44 PM, Gene Sullivan
Attached is the patch in git format. splain needs not be patched since it's generated from diagnostics.pm. I wanted to add a regression test, but I couldn't find where - Eric |
From @ikegami0001-diagnostics-hides-warnings-RT-71204.patchFrom e2c32c98e851a2bb7f0d7b689eecb870befe22ed Mon Sep 17 00:00:00 2001
From: Gene Sullivan
Date: Sat, 12 Dec 2009 11:24:43 -0800
Subject: [PATCH] diagnostics hides warnings RT#71204
---
lib/diagnostics.pm | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/lib/diagnostics.pm b/lib/diagnostics.pm
index d65df19..d754fd5 100644
--- a/lib/diagnostics.pm
+++ b/lib/diagnostics.pm
@@ -222,6 +222,7 @@ my $WHOAMI = ref bless []; # nobody's business, prolly not even mine
local $| = 1;
my $_;
+local $.;
my $standalone;
my(%HTML_2_Troff, %HTML_2_Latin_1, %HTML_2_ASCII_7);
--
1.6.5.2
|
The RT System itself - Status changed from 'new' to 'open' |
@rgs - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#71204 (status was 'resolved')
Searchable as RT71204$
The text was updated successfully, but these errors were encountered: