Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Catching errors in closing lexical filehandles

by gaal (Parson)
on Sep 27, 2004 at 07:27 UTC ( #394091=note: print w/replies, xml ) Need Help??


in reply to Re: Catching errors in closing lexical filehandles
in thread Catching errors in closing lexical filehandles

Allowing multiple opens form the same code is a great benefit, perhaps even the greatest, but who said it's the only one? davido mentions a few others, all of which IMHO are valid.

Regarding "you do your error checking on open, not close", this is not quite correct. Close can have errors, e.g. when the file is a pipe that has been closed on the other side.

And regarding die, in the first instance, I was using it as a token for "any appropriate error handling I might choose to apply here". In the second instance, you can (and I often do) achieve protection from termination by catching the die with an eval somewhere up the call train.

  • Comment on Re^2: Catching errors in closing lexical filehandles

Replies are listed 'Best First'.
Re^3: Catching errors in closing lexical filehandles
by TedPride (Priest) on Sep 27, 2004 at 08:11 UTC
    Yes, but the point of closing a file is to have it closed, and does it really matter whether it closes from the server side or the client side? Perhaps I should have said no important errors rather than no errors...
      This situation can be indicative of a real applicative failure. perlipc gives the matter some discussion in the secion called "Using open() for IPC".

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://394091]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2020-05-31 04:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (173 votes). Check out past polls.

    Notices?