Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: existing file is modified or not

by steves (Curate)
on Nov 25, 2004 at 13:25 UTC ( #410391=note: print w/ replies, xml ) Need Help??


in reply to Re: existing file is modified or not
in thread existing file is modified or not

Another approach would be to create your new file as a unique temporary file, then use something like Text::Diff to diff the two files. If they differ, you remove the old one and rename the new (temporary) one to the name of the old removed file. If they are the same, you just remove the temporary file.

I agree about the locking: to do this without race conditions, you should consider locking the target file. You may also be able to use file modification times to see if the file has changed since you started looking at it.


Comment on Re^2: existing file is modified or not

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://410391]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (10)
As of 2014-07-28 13:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (199 votes), past polls