summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorDominic Dunlop <domo@slipper.ip.lu>1997-06-16 11:36:14 +1200
committerTim Bunce <Tim.Bunce@ig.co.uk>1997-08-07 00:00:00 +1200
commit08e9d68e93f9880dc9a1edcde3abb85026f49784 (patch)
tree91b1649fae5e4a3033997482c0e2c988f8e0af20 /toke.c
parent7bc39d6220d2b77d9c5827625d97cd2af6ef9c56 (diff)
downloadperl-08e9d68e93f9880dc9a1edcde3abb85026f49784.tar.gz
-p does not check for failure of implicit print
Unlike modern incarnations of, say, awk and sed, perl -p does not check the return status of the implicit print statement executed for each input record. Here's a patch against 5.004_01. ('ware wrapping: there's a long line in it.) There's no test case: I couldn't think up a reliable, portable and polite way of inducing a write error. I think, in the specific case of the implicit print in -p, this is non-controversial, and can go in the maintenance branch. That's not to say that there are not programs using -p out there (probably CGI scripts) which will surprise people by exiting noisily on encountering an error, rather than continuing to do thewrong thing quietly. Does anybody know of any widespread examples? Do we care? More controversial error checking patch for implicit close of <ARGV> to follow in separate bug report. p5p-msgid: v0311070aafea3fa83061@[194.51.248.75]
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/toke.c b/toke.c
index c5c32bf0e3..f443af7442 100644
--- a/toke.c
+++ b/toke.c
@@ -369,7 +369,9 @@ register char *s;
return s;
if ((s = filter_gets(linestr, rsfp, (prevlen = SvCUR(linestr)))) == Nullch) {
if (minus_n || minus_p) {
- sv_setpv(linestr,minus_p ? ";}continue{print" : "");
+ sv_setpv(linestr,minus_p ?
+ ";}continue{print or die qq(-p destination: $!\\n)" :
+ "");
sv_catpv(linestr,";}");
minus_n = minus_p = 0;
}