Do you know where your variables are? | |
PerlMonks |
Re: Win32: Setting a layer with binmode causes problem with close() on Windows (PerlIO silently fails to close the file)by BrowserUk (Patriarch) |
on Jun 17, 2013 at 10:39 UTC ( [id://1039328]=note: print w/replies, xml ) | Need Help?? |
First up. PerlIO layers are definitely a part of this problem. Commenting out the binmode makes it go away (as you already know>). But, it is (much) more complicated than that. At the point where the unlink fails, (at least) two processes are hanging on to handles to that file:
Also, running the command to create the file from within the script is confusing things and there is no need for it. This simplified version of your script:
exhibits exactly the same behaviour when the file is pre-created:
Only one process has a handle to the file, and that process is Perl itself. (Tentative) Conclusion: The error message is wrong, or at least, misleading. The "other process" that is preventing the unlink, is actually the same process that is trying to perform the unlink. Essentially, the close has failed (silently), or has simply not been enacted, and so the unlink cannot proceed because there is an open handle to the file. Tracking this further means delving into IO layers ... why did the close fail silently? With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
In Section
Seekers of Perl Wisdom
|
|