From: Hugo van der Sanden Date: Mon, 13 Oct 1997 11:23:56 +0000 (+0100) Subject: [win32] maintpatch X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bde90e6697646d73abeebaccd6d7fdd8c9aa0c9f;p=p5sagit%2Fp5-mst-13.2.git [win32] maintpatch #73: "Fix order of warnings for misplaced subscripts" Msg-ID: <199710131023.LAA16796@crypt.compulink.co.uk> Files: op.c p4raw-id: //depot/win32/perl@639 --- diff --git a/op.c b/op.c index f6857af..fec6705 100644 --- a/op.c +++ b/op.c @@ -86,9 +86,17 @@ assertref(OP *o) int type = o->op_type; if (type != OP_AELEM && type != OP_HELEM) { yyerror(form("Can't use subscript on %s", op_desc[type])); - if (type == OP_ENTERSUB || type == OP_RV2HV || type == OP_PADHV) - warn("(Did you mean $ or @ instead of %c?)\n", - type == OP_ENTERSUB ? '&' : '%'); + if (type == OP_ENTERSUB || type == OP_RV2HV || type == OP_PADHV) { + SV *msg = sv_2mortal( + newSVpvf("(Did you mean $ or @ instead of %c?)\n", + type == OP_ENTERSUB ? '&' : '%')); + if (in_eval & 2) + warn("%_", msg); + else if (in_eval) + sv_catsv(GvSV(errgv), msg); + else + PerlIO_write(PerlIO_stderr(), SvPVX(msg), SvCUR(msg)); + } } }