# HG changeset patch # User Matti Hamalainen # Date 1443958443 -10800 # Node ID 3fff571a904b93107b83030d3dd9bf8c20edc657 # Parent 8212fe58da45bbd35e765e3fd1f9f2f1fa689ef7 fetch_weather: Some fixes to make this actually work. diff -r 8212fe58da45 -r 3fff571a904b fetch_weather.pl --- a/fetch_weather.pl Sun Oct 04 14:24:42 2015 +0300 +++ b/fetch_weather.pl Sun Oct 04 14:34:03 2015 +0300 @@ -318,10 +318,11 @@ # Parse the data .. my $meta_data = {}; - my $csv = Text::CSV->new({blank_is_undef => 1, decode_utf8 => 1}); + my $csv = Text::CSV->new({blank_is_undef => 1}); + die("Failed to instantiate Text::CSV object?\n") unless defined($csv); foreach my $line (split(/\s*\n\s*/, $meta_str)) { - if ($csv->parse($line)) + if (defined($line) && $csv->parse($line)) { my @fields = $csv->fields(); $$meta_data{$fields[1]} = \@fields; @@ -338,7 +339,7 @@ { $weatherdata->{$meta_data->{$wid}[3]} = [ - 0, + 1, str2time(plonk_data($wdata->{"measurementtime"}{"utc"})), plonk_data($wdata->{"airtemperature1"}),