I'm trying to test if a file is opened by another process but am not getting any results for the flock command in Perl. I have a very simple test script:
use Fcntl qw(:DEFAULT :flock);
No mater if the file is opened or not, it returns 0 all the time, which means that it is locked. What am I doing wrong? It is running on Unix AIX. Is there a system command I should use or is flock pretty accurate at the OS level? I'm asking because not only my script is accessing this file, but a completely different software program is access the file. So I want to be able to detect is the file is open at all but I'm not getting any results. Please help! Thanks in advance.