Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: Re: On timely destruction?

by Elian (Parson)
on Aug 28, 2002 at 01:47 UTC ( #193333=note: print w/ replies, xml ) Need Help??

in reply to Re: On timely destruction?
in thread On timely destruction?

That's fine--that sort of thing is still perfectly legal and will be handled fine. The question is: Do you depend on the returned filehandle being immediately closed when the variable holding it goes out of scope? If "sooner or later, as long as it's not too much later" is OK (and the later part is on the order of milliseconds, usually), then it's not a problem and not something I need to worry about here.

Comment on Re: Re: On timely destruction?
Replies are listed 'Best First'.
Re: Re: Re: On timely destruction?
by Anonymous Monk on Aug 28, 2002 at 02:10 UTC
    The main problem that I see is that people may do a lot of suffering from buffering. For instance in a function they write to a file. But they don't have an explicit close, so it doesn't get flushed until gc. Elsewhere you interact with the same file (perhaps you called the same function again) and get all confused when data that you know has been written, hasn't been. (And since you are sure that it has been written - a fact that you can verify by looking at it in an editor - you will look everywhere else for the problem instead...)
Re: Re: Re: On timely destruction?
by theorbtwo (Prior) on Aug 28, 2002 at 01:54 UTC

    Well, in the case of most of the scripts I write, no, I don't rely on timely destruction; I rarely deal with high-contention files. However, even with fairly high-contention files (and suchlike things), an unlock being a few ms late shouldn't be to terrible.

    Confession: It does an Immortal Body good.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2015-10-06 19:23 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (159 votes), past polls