Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
The first open, flock, print, and close work fine. Then when I call function, it is able to open the file, but the flock fails. If I don't flock the file, I'm able to read the first line from the file and print it. But I do need to lock the file. Am I correc to assume that the close in login.cgi will unlock the file? Can anyone help. Thanks, Michael#start of login.cgi open(FILE, "file.log"); flock(FILE, LOCK_EX); 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, LOCK_EX); $a = <FILE>; print "line: $a\n"; close FILE; #end of login.pl 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: flock problem
by jjhorner (Hermit) on Jul 14, 2000 at 21:09 UTC | |
|
Re: flock problem
by Ovid (Cardinal) on Jul 14, 2000 at 20:07 UTC | |
|
Re: flock problem
by c-era (Curate) on Jul 14, 2000 at 21:53 UTC | |
by chromatic (Archbishop) on Jul 14, 2000 at 22:37 UTC | |
|
Re: flock problem
by mikfire (Deacon) on Jul 14, 2000 at 22:54 UTC |