close() or die

J

John Bokma

Recently a customer reported that a Perl script I had written suddenly
reported an error.

It turned out that it failed on the close (it died and reported that the
close failed after writing to the file).

It turned out that his disk quota had exceeded. So it seems that the close
flushed the buffer, which failed, and my script nicely reported this.

Bottomline: check your close. Without this it would have not been obvious.
Even if I use auto-vivication, I close explicitly.
 
A

Alan Curry

Recently a customer reported that a Perl script I had written suddenly
reported an error.

It turned out that it failed on the close (it died and reported that the
close failed after writing to the file).

It turned out that his disk quota had exceeded. So it seems that the close
flushed the buffer, which failed, and my script nicely reported this.

Bottomline: check your close. Without this it would have not been obvious.
Even if I use auto-vivication, I close explicitly.

Testify!

Even if you don't print anywhere but STDOUT, close it and check it.
Redirected STDOUT can have write errors too.
 
X

xhoster

John Bokma said:
Recently a customer reported that a Perl script I had written suddenly
reported an error.

It turned out that it failed on the close (it died and reported that the
close failed after writing to the file).

It turned out that his disk quota had exceeded. So it seems that the
close flushed the buffer, which failed, and my script nicely reported
this.

Bottomline: check your close. Without this it would have not been
obvious.
Even if I use auto-vivication, I close explicitly.

Also, if you use a pipe-open, some errors are only detected on close.

Xho
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,233
Latest member
AlyssaCrai

Latest Threads

Top