in reply to Checking success of open() on file held in scalar ref.

I've run in to cases in my current job where checking for close is very important. If we have very little disk space(or no disk space), files can be open-ed(and created) since they just created an empty file but when we write to them and then try and close the file it fails. Knowing that the close failed allows us to do error recovery and try to write that file again later. It's saved us a lot of time - from time to time. Checking for open is always advisable otherwise you're going to print/read to a file handle you don't actually have.
  • Comment on Re: Checking success of open() on file held in scalar ref.

Replies are listed 'Best First'.
Re^2: Checking success of open() on file held in scalar ref.
by djp (Hermit) on Nov 15, 2007 at 05:56 UTC
    Suggest checking for print failure, as well as close failure, via 'print FH or die $!'. Use /dev/full for testing this otherwise hard-to-test condition.

      What OS contains /dev/full?

      --MidLifeXis

        Linux, should've mentioned that.