restore data saving
authorDirk Koopman <djk@tobit.co.uk>
Tue, 27 Jan 2015 11:49:21 +0000 (11:49 +0000)
committerDirk Koopman <djk@tobit.co.uk>
Tue, 27 Jan 2015 11:49:21 +0000 (11:49 +0000)
loop.pl

diff --git a/loop.pl b/loop.pl
index 1fb8998e2361a4a1f8a3f43c7925648fb4c61586..bb28f1843e7372b2164aa90c7427ab2ae32b3b2f 100755 (executable)
--- a/loop.pl
+++ b/loop.pl
@@ -157,6 +157,8 @@ dbg "after app start";
 
 write_ld();
 $dataf->close if $dataf;
+undef $dataf;
+
 
 # move all the files along one 
 cycle_loop_data_files();
@@ -534,7 +536,7 @@ sub gen_hash_diff
        my $count;
 
        while (my ($k, $v) = each %$now) {
-               if ($last->{$k} ne $now->{$k}) {
+               if (!exists $last->{$k} || $last->{$k} ne $now->{$k}) {
                        $o{$k} = $v;
                        ++$count;
                }
@@ -698,6 +700,7 @@ sub write_ld
 sub cycle_loop_data_files
 {
        $dataf->close if $dataf;
+       undef $dataf;
        
        rename "$datafn.oooo", "$datafn.ooooo";
        rename "$datafn.ooo", "$datafn.oooo";