CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
How to wait when another process in accessing a file?

 



hujirong
Novice

Aug 26, 2015, 6:59 AM

Post #1 of 1 (872 views)
How to wait when another process in accessing a file? Can't Post

Hi All

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?

Thanks
Jirong
Attachments: test_id.pl (1.55 KB)
  APIUSR.txt (100 B)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives