你如何检查一个文件是否使用Perl打开? [英] How do you check if a file is open using Perl?
问题描述
请注意,我正在寻找一种通用的Perl解决方案,而不是特定于操作系统的解决方案。至少,我希望在Windows和基于GNU / Linux的系统上都可以运行。
POSIX不提供任何方式来做到这一点。因此,考虑到当前的可用便携式O / S接口,没有便携式解决方案。
您必须制定一些更高级别的方法,为开放位提供单一访问点。这就像锁文件。
Given the name of a file, how can I determine if the file is currently opened or in-use? (I am talking about files rather than Perl file handles.)
Please note that I am looking for a general-purpose Perl solution rather than an operating system-specific one. At a minimum, I would like something that works both on Windows and GNU/Linux-based systems.
POSIX does not provide any way to do this. Therefore, no portable solution is possible given the current portable O/S interface available.
You’d have to craft some higher level approach that provides a single point of access for the opening bits. It’s like with lock files.
这篇关于你如何检查一个文件是否使用Perl打开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!