ctilmes has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to do an atomic update of a file using Net::SFTP.
Typically what I would do is write to "file.tmp", then rename to "file" when complete.
What I find is that Net::SFTP::do_rename() fails if the file I am renaming to already exists. If I use do_remove() of the old file prior to the do_rename() it all works fine, but then there is an (albeit small) window between the do_remove() and do_rename() where the file doesn't exist.
Is there some other technique I should be using to update the file over SFTP?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Net::SFTP atomic updates?
by grinder (Bishop) on Feb 03, 2005 at 14:15 UTC | |
Re: Net::SFTP atomic updates?
by ctilmes (Vicar) on Feb 03, 2005 at 15:05 UTC | |
Re: Net::SFTP atomic updates?
by samizdat (Vicar) on Feb 03, 2005 at 14:08 UTC |
Back to
Seekers of Perl Wisdom