Aug 26, 2015, 6:59 AM
Post #1 of 1
How to wait when another process in accessing a file?
I wrote two subs PopId() and PushId() to share 10 login ids with many users. Sometimes I got an error like this:
\Could not open '\\ccreqpwebp01\ccstg\Informatica\APIUSR.txt' - Permission denied at \\ccreqpwebp01\ccstg\Informatica/bccpbmod.pm line 1206.
line 1206 is open the file to write.
open (my $fd, ">>$path_to_file") or die "Could not open '$path_to_file' - $!";
I did a quick test with attached test_id.pl, run it from two different command window at the same time, the first will go though, but the second one hangs with no output.
Can anyone help me to get this right?