Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: Why do we need to close filehandles?

by sundialsvc4 (Abbot)
on Apr 30, 2011 at 12:25 UTC ( [id://902176]=note: print w/replies, xml ) Need Help??


in reply to Re: Why do we need to close filehandles?
in thread Why do we need to close filehandles?

Bingo!   There’s a solid technical reason for paying close attention to file-handles ... buffering.   Until a file-handle is closed, it is possible that there’s some data out there which has not been written to disk.   Other applications will not see that data yet; nor will this application, necessarily, if it opens a second handle to the same file.   (Which it is, of course, free to do.)

Obviously, the system will wipe your a*s ... clean up after you even if you don’t, but writing to a file is an action that you need to explicitly bring to a close.   Reading from the file is much more forgiving.

Replies are listed 'Best First'.
Re^3: Why do we need to close filehandles?
by JavaFan (Canon) on May 01, 2011 at 16:08 UTC
    There’s a solid technical reason for paying close attention to file-handles ... buffering.
    Well, you can just flush the handle; there's no need to close it. And if you do things in a logical way, you either read/write using buffered I/O, or you read/write using unbuffered I/O. In either case, you should be fine.

Log In?
Username:
Password:

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

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

    No recent polls found