diff options
author | Graham Barr <gbarr@pobox.com> | 1999-03-03 11:23:56 -0600 |
---|---|---|
committer | Graham Barr <gbarr@pobox.com> | 1999-03-28 03:40:28 +0000 |
commit | b8986743345ce694a882cee22e513de1de7cd890 (patch) | |
tree | f6a067a9bf70897a39998cb22f58c9b9034920da | |
parent | 3c798f74a641ef1819699fe5d5c156d30ad033bc (diff) | |
download | perl-b8986743345ce694a882cee22e513de1de7cd890.tar.gz |
Integrate changes #3067 and #3106 from mainline
exempt $foo::a,$foo::b from warnings only if sort() was seen in package foo
Message-ID: <19990303172356.F7442@dal.asp.ti.com>
Subject: Re: 'use strict' doesn't work for one-letter variables
change#3067 failed package.t due to needless creation of $a and $b;
fixed to do that only for C<sort BLOCK|CODE @foo>, not C<sort(@foo)>
p4raw-link: @3067 on //depot/perl: 39ab52836386b91d2e2c323dd305cf42e6be3133
p4raw-id: //depot/maint-5.005/perl@3182
-rw-r--r-- | gv.c | 6 | ||||
-rw-r--r-- | op.c | 5 | ||||
-rw-r--r-- | t/pragma/warn-1global | 3 |
3 files changed, 8 insertions, 6 deletions
@@ -616,12 +616,6 @@ gv_fetchpv(char *nambeg, I32 add, I32 sv_type) IoFLAGS(GvIOn(gv)) |= IOf_ARGV|IOf_START; } break; - - case 'a': - case 'b': - if (len == 1) - GvMULTI_on(gv); - break; case 'E': if (strnEQ(name, "EXPORT", 6)) GvMULTI_on(gv); @@ -4809,6 +4809,11 @@ ck_sort(OP *o) if (o->op_flags & OPf_STACKED) { OP *kid = cLISTOPo->op_first->op_sibling; /* get past pushmark */ OP *k; + + if (o->op_type == OP_SORT) { + GvMULTI_on(gv_fetchpv("a", TRUE, SVt_PV)); + GvMULTI_on(gv_fetchpv("b", TRUE, SVt_PV)); + } kid = kUNOP->op_first; /* get past rv2gv */ if (kid->op_type == OP_SCOPE || kid->op_type == OP_LEAVE) { diff --git a/t/pragma/warn-1global b/t/pragma/warn-1global index 3427f902fb..a7ca607077 100644 --- a/t/pragma/warn-1global +++ b/t/pragma/warn-1global @@ -12,12 +12,14 @@ EXPECT $a =+ 3 ; EXPECT Reversed += operator at - line 3. +Name "main::a" used only once: possible typo at - line 3. ######## #! perl -w # warnable code, warnings enabled via #! line $a =+ 3 ; EXPECT Reversed += operator at - line 3. +Name "main::a" used only once: possible typo at - line 3. ######## # warnable code, warnings enabled via compile time $^W @@ -25,6 +27,7 @@ BEGIN { $^W = 1 } $a =+ 3 ; EXPECT Reversed += operator at - line 4. +Name "main::a" used only once: possible typo at - line 4. ######## # compile-time warnable code, warnings enabled via runtime $^W |