[sf-perl] Bad file number
doom at kzsu.stanford.edu
Fri Jun 22 11:36:37 PDT 2007
Joe Brenner <doom at kzsu.stanford.edu> wrote:
> But as for the question "How many ways can close() fail"?
> That beats me, I've never looked into it. What happens if you close
> a file that's been deleted by another process? Or if it was a symlink
> that's been redefined in the meantime? Or if it's on a partition that
> got filled up since it was opened? Of if it's been flocked?
> Or if it's ownership/permissions has changed?
> Conway, in his "Perl Best Practices" says:
> "Never open, close, or print to a file without checking the outcome."
> And I presume he's included "close" in the list for a reason.
> He also (later, in "Builtin Failures", ch 13) recommends the trick:
> use Fatal qw( open close );
> So that you don't have to remember to "or croak" all over the place.
Oh, and just to save Randal some trouble:
More information about the SanFrancisco-pm