From: Kay_Röpke <kay@dolphin-services.de>
Date: Fri, 20 Sep 2002 16:09:08 +0000 (+0200)
Subject: [perl #10021] Fixing bareword usage under strict.pm
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=989dfb198ac9ac51842b1c51f1d0abd5c0143573;p=p5sagit%2Fp5-mst-13.2.git

[perl #10021] Fixing bareword usage under strict.pm
Message-Id: <8775B355-CCA2-11D6-AADE-000393414688@dolphin-services.de>

p4raw-id: //depot/perl@17931
---

diff --git a/op.c b/op.c
index 67aeab0..75d642f 100644
--- a/op.c
+++ b/op.c
@@ -3883,8 +3883,12 @@ S_new_logop(pTHX_ I32 type, I32 flags, OP** firstp, OP** otherp)
 	}
     }
     if (first->op_type == OP_CONST) {
-	if (ckWARN(WARN_BAREWORD) && (first->op_private & OPpCONST_BARE))
-	    Perl_warner(aTHX_ packWARN(WARN_BAREWORD), "Bareword found in conditional");
+	if (ckWARN(WARN_BAREWORD) && (first->op_private & OPpCONST_BARE)) {
+	    if (first->op_private & OPpCONST_BARE)
+		no_bareword_allowed(first);
+	    else
+		Perl_warner(aTHX_ packWARN(WARN_BAREWORD), "Bareword found in conditional");
+	}
 	if ((type == OP_AND) == (SvTRUE(((SVOP*)first)->op_sv))) {
 	    op_free(first);
 	    *firstp = Nullop;
diff --git a/t/lib/strict/subs b/t/lib/strict/subs
index 4a90809..89a0bad 100644
--- a/t/lib/strict/subs
+++ b/t/lib/strict/subs
@@ -345,3 +345,12 @@ print "$abc\n";
 EXPECT
 Bareword "XYZ" not allowed while "strict subs" in use at - line 5.
 Execution of - aborted due to compilation errors.
+########
+
+# [perl #10021]
+use strict;
+use warnings;
+print "" if BAREWORD;
+EXPECT
+Bareword "BAREWORD" not allowed while "strict subs" in use at - line 5
+Execution of - aborted due to compilation errors.