diff options
author | Robin Barker <RMBarker@cpan.org> | 2003-06-11 19:10:14 +0100 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2003-06-12 20:49:25 +0000 |
commit | dca6e23fb83957e896abba24cceb553cbf56fb78 (patch) | |
tree | 5c250bf50f16eda93a9c311c1ff60f94f728bdd9 /sv.c | |
parent | f93414403b07cda0cb271cd283f020f4981ff2c8 (diff) | |
download | perl-dca6e23fb83957e896abba24cceb553cbf56fb78.tar.gz |
Add a new warning, "Newline in left-justified string for printf/sprintf"
to be issued if the string to be left-justified by s?printf contains
a newline.
Subject: [PATCH] RE: [perl #22599] Strange behaviour when combining foreac h and printf
Message-ID: <533D273D4014D411AB1D00062938C4D904046571@hotel.npl.co.uk>
p4raw-id: //depot/perl@19752
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -9329,6 +9329,11 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV p = SvEND(sv); *p = '\0'; } + if (left && ckWARN(WARN_PRINTF) && strchr(eptr, '\n') && + (PL_op->op_type == OP_PRTF || PL_op->op_type == OP_SPRINTF)) + Perl_warner(aTHX_ packWARN(WARN_PRINTF), + "Newline in left-justified string for %sprintf", + (PL_op->op_type == OP_PRTF) ? "" : "s"); have = esignlen + zeros + elen; need = (have > width ? have : width); |