develooper Front page | perl.perl5.porters | Postings from November 1999

IO::File and RaiseError?

Thread Previous | Thread Next
Martyn Pearce
November 25, 1999 03:12
IO::File and RaiseError?
Message ID:


Here's an idea that appeared from a real-world example;

1)	print, printf & close should always be checked for errors (I'm
deliberately excluding open here).

2)	Many disciplined programmers will remember to check these when
dealing with files but not when d/w STDOUT.

3)	STDOUT really should be checked (we got caught out when STDOUT
is redirected; and the FS filled).

3)	A very common mechanism is simply to die in case of error.

4)	It would save several keystrokes, and possibly some loss of
data, if IO::File objects had some RaiseError attribute that caused a
check on write and close, and died in case of error, a la DBI.
Naturally, this would *not* be used by default.

5)	This could be per IO::File instance, and/or a global IO::File
param could be set (that presumably just affected *new* instances,
although we could even back-affect things if that was desirable.


1)	Am I making sense?
2)	Does this seem to be a desirable addition?
3)	Any further related suggestions?

I would be very happy to do the work & submit a patch, if you felt that
this idea is appropriate.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About