Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: forgoing explicit file close

by fishmonger (Chaplain)
on Aug 21, 2015 at 19:49 UTC ( [id://1139457]=note: print w/replies, xml ) Need Help??


in reply to forgoing explicit file close

Letting perl close the filehandle when it goes out of scope is a common and acceptable practice. However, IMO it would be best practice to do an explicit close on write filehandles and apply error handling on it. The reason is that between the time the file was opened and when it goes out of scope a problem could have developed where the file is no longer available; such as if it was being connected to over an nfs share/mount and that mount point was lost do to some network issue. In that case, unless you were error checking all writes, you would not know about the problem until it was to late.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-03-29 08:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found