OSDN Git Service

use File::Copy::move insted of rename (to be able to move a file accross file system)
authorISHIKAWA Mutsumi <ishikawa@hanzubon.jp>
Fri, 2 Nov 2012 18:09:10 +0000 (03:09 +0900)
committerISHIKAWA Mutsumi <ishikawa@hanzubon.jp>
Fri, 2 Nov 2012 18:09:10 +0000 (03:09 +0900)
lib/Mubot4FB/FeedWorker.pm

index 30f4b54..e9f3ee2 100644 (file)
@@ -13,6 +13,7 @@ use Net::PubSubHubbub::Publisher;
 use JSON::XS;
 use Mubot4FB::DB;
 use File::Temp qw/tempfile/;
+use File::Copy qw/move/;
 
 use constant DATA_VERSION => '0.1';
 
@@ -42,7 +43,7 @@ sub work {
                my ($fh, $tmp_file) = tempfile("tmpjsonXXXXXX", DIR => $tmpdir);
                print $fh encode_json($out);
                close($fh);
-               rename $tmp_file, $me->{cfg}->{json_path} || warn 'can not rename from ' . $tmp_file . ' to ' . $me->{cfg}->{json_path};
+               move $tmp_file, $me->{cfg}->{json_path} || warn 'can not rename from ' . $tmp_file . ' to ' . $me->{cfg}->{json_path};
        }
 }