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

IO::File and RaiseError?

Thread Previous | Thread Next
From:
Martyn Pearce
Date:
November 25, 1999 03:12
Subject:
IO::File and RaiseError?
Message ID:
14397.6432.795965.51498@kingsbury.inpharmatica.co.uk

Greetings,

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.

So:

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.

Mx.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About