Patching previous path (File::Copy::move is even more suitable for the task, than cp+unlink, works efficiently if temp is on the same drive and reverts to cp+unlink otherwise).

This commit is contained in:
Marcin Kasperski
2012-11-15 09:25:59 +01:00
parent 5568a6cc1e
commit dc40f820d9

View File

@@ -15,7 +15,7 @@ use Digest::HMAC;
use Digest::SHA; use Digest::SHA;
use Crypt::Random qw( makerandom ); use Crypt::Random qw( makerandom );
use Data::UUID; use Data::UUID;
use File::Copy qw(cp); use File::Copy qw(copy move);
use File::Spec; use File::Spec;
use FileHandle; use FileHandle;
use Data::Dumper; use Data::Dumper;
@@ -375,8 +375,7 @@ sub save {
} }
else { else {
# well, seems to be ok :) # well, seems to be ok :)
cp($tmpfile, $file); move($tmpfile, $file);
unlink $tmpfile;
} }
} }