Lets say I have the following:
#!/usr/bin/perl
use strict;
use warnings;
use CGI ":standard";
...Snippet...
open (FH, '>', "file.txt") or die ("ERROR:$!");
print FH "something";
close(FH);
As it it cgi on Apache, this cgi script could be called concurrently.
- How does writing and reading occur when concurrently called?
- There are no locks or such correct?
What happens if I wanted conditional logic...
- wait until lsof shows file is clear
- Read from file
- concat with text
- write to file
I am investigating utilizing lsof for setting up synchronous file locking, but do not want to go down bad path. (Might be better off using SQL).