diff options
author | Hugo van der Sanden <hv@crypt.org> | 1997-10-13 12:23:56 +0100 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-03-03 04:09:11 +0000 |
commit | bde90e6697646d73abeebaccd6d7fdd8c9aa0c9f (patch) | |
tree | c987887fa99f8be975018332a69e129b300148e4 /op.c | |
parent | ae66e5c8da1e140f494c5cf16334db605c3aac5a (diff) | |
download | perl-bde90e6697646d73abeebaccd6d7fdd8c9aa0c9f.tar.gz |
[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
Diffstat (limited to 'op.c')
-rw-r--r-- | op.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -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)); + } } } |