From: Dirk Koopman Date: Sat, 24 Jan 2015 00:04:26 +0000 (+0000) Subject: prefer rename over copy for loop_data shuffle X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=0fb8df3c81c404b27f96d416fd029b875495554a;p=dweather.git prefer rename over copy for loop_data shuffle --- diff --git a/loop.pl b/loop.pl index ef8a673..b5e939d 100755 --- a/loop.pl +++ b/loop.pl @@ -14,6 +14,7 @@ use Debug; use SMGLog; use Math::Round qw(nearest); use File::Copy; +use Data::Random qw(rand_chars); use constant pi => 3.14159265358979; @@ -155,12 +156,7 @@ write_ld(); close $dataf if $dataf; # move all the files along one -copy "$datafn.oooo", "$datafn.ooooo"; -copy "$datafn.ooo", "$datafn.oooo"; -copy "$datafn.oo", "$datafn.ooo"; -copy "$datafn.o", "$datafn.oo"; -copy $datafn, "$datafn.o"; - +cycle_loop_data_files(); dbg '***'; dbg "*** ending $0"; @@ -664,6 +660,14 @@ sub write_ld print $dataf "$s\n"; } +sub cycle_loop_data_files +{ + rename "$datafn.oooo", "$datafn.ooooo"; + rename "$datafn.ooo", "$datafn.oooo"; + rename "$datafn.oo", "$datafn.ooo"; + rename "$datafn.o", "$datafn.oo"; + copy $datafn, "$datafn.o"; +} __DATA__ @@ -745,7 +749,7 @@ __DATA__ Minute Avg: -Rain Hour: +Rain 30mins: Day: 24hrs: Month: