laziness, impatience, and hubris | |
PerlMonks |
Re^3: Finding if a file is openby starbolin (Hermit) |
on May 15, 2008 at 16:32 UTC ( [id://686771]=note: print w/replies, xml ) | Need Help?? |
If the other application (OA) is using file locking then flock() is the correct way. You first open() the filehandle. (There is no harm in this even if the OA is using the file.) Then you call flock() to attempt to acquire the write permission to the file. The return status tells you whether the file has been locked ('in use') by an OA. If the other application is using some proprietary locking scheme then of course you have to deduce what that scheme is.
s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}
In Section
Seekers of Perl Wisdom
|
|