Well, actually, I was looking for an answer like Perl should guarantee proper closing of the file if the file if the local handle goes out of scope, or otherwise Perl does not guarantee that this happens. Maybe I didn't made myself clear in this respect, but the problem wasn't what to do to avoid this problem (in my case, I simply put a close in the end of the block), but whether this problem (in a correct Perl installation) is supposed to appear at all; for, in case this is something which is supposed to work, but at my colleagues system it occasionally does not work, this means that we have a fundamental problem lurking somewhere on his platform which is well worth investigating. Otherwise, in case it is really undefined behaviour in Perl, but just happens to work *usually*, there is no need to research further.
From my understanding of Perl, I could not decide this question. The link I mentioned in an earlier post seems to suggest that this is well defined behaviour in Perl, but of course this article could also be wrong, or I could have misinterpreted it. So I was hoping that someone would know what exactly happens in Perl if a local filehandle goes out of scope. Given the length of this discussion, this seems to be a dark corner in Perl.
Actually, it maybe has implications to other areas as well. For instance, if I have a local scalar, holding a blessed reference, and this scalar goes out of scope (and there are no accesses to this reference any more); does Perl guarantee then that the DESTROY function of this object will be executed immediately, or could it be that it is called at some later time?
--
Ronald Fischer <ynnor@mm.st>
| [reply] [Watch: Dir/Any] [d/l] |
That's fine, but you didn't provide a sample that repros on your coworker's machine, nor say what type of machine it is. Investigation cannot happen if you do not help others help you. Even if perl defined the behavior clearly, a bug may exist (even in your code).
| [reply] [Watch: Dir/Any] |
| [reply] [Watch: Dir/Any] |