[perl #10021] Fixing bareword usage under strict.pm
Kay_Röpke [Fri, 20 Sep 2002 16:09:08 +0000 (18:09 +0200)]
Message-Id: <8775B355-CCA2-11D6-AADE-000393414688@dolphin-services.de>

p4raw-id: //depot/perl@17931

op.c
t/lib/strict/subs

diff --git a/op.c b/op.c
index 67aeab0..75d642f 100644 (file)
--- 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;
index 4a90809..89a0bad 100644 (file)
@@ -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.