I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2009-11-06 14:54:50-08 by rkstar
XML File locking?
I'm currently writing a program that will read and write to an XML file a lot. What sort of protection is there from XMLin trying to read a file that's currently being written to? I can't find any mention anywhere.
Direct Responses: 11721 | Write a response
Posted on 2009-11-06 15:24:16-08 by exiftool in response to 11719
Re: XML File locking?
If you're on Windows, the operating system won't let you do this. On other operating systems you'll have to do something like create a temporary ".lock" file and not process the XML file if a ".lock" file exists. You must be careful because there is a race condition creating the .lock file so you must be able to tell which process created it first. I usually write the process number to the file then read back the first line of the file to make sure it is my process. Otherwise some other process created the .lock file so the current process must wait until it is deleted by the owning process.
Direct Responses: Write a response