{{ I filed this comment in RT and asked it to copy p5p, but over an hour
later I don't see it. I wonder what's up with that? Meanwhile... }}
A first step in handling write errors in -pi would be dying if either print
or close returns false. This would be a significant change from the old
ways, but I think it's OK ... data loss is one of the primary evils, after
all.
As for restoring the partially read file back to its original name on
error: I actually think that's a bad idea. There may be a LOT of
processing involved, and partial output is definitely better than no
output in some circumstances.
Finally, adding death to the behavior of existing code that has its own
read/print loop is far more questionable, and I'd rather not do it. In
other words, if you write this you should get death on disk full:
perl -pi~ 's/foo/bar/' *.c
But if you write this you should _not_ get automatic death:
#!/usr/bin/perl
$^I = '~';
while (<>) { ....; print }
Comments?
--
Chip Salzenberg <chip@pobox.com>