in reply to flock problem
You also shouldn't use an exclusive lock when reading from a file, you should use a shared lock.
This is how I got the code to work.
#start of login.cgi open(FILE, ">file.log"); flock(FILE, 2); # 2 is an exclusive lock print FILE "$a:$b:$c\n"; close FILE; #call function function (); # return 0; #end of login.cgi ------------------- ;#start of login.pl sub function { open(FILE, "<file.log"); flock(FILE, 1); # 1 is a shared lock $a = <FILE>; print "line: $a\n"; close FILE; #end of login.pl 1; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(chromatic) RE: Re: flock problem
by chromatic (Archbishop) on Jul 14, 2000 at 22:37 UTC |