summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2013-05-17 21:07:38 +0100
committerdakkar <dakkar@thenautilus.net>2013-05-17 21:07:38 +0100
commit6bbe2df38ad465ad0151c07397d7d85bf0e841dc (patch)
tree9c19cf05e4cb33c0cc7eeda5c3764d30e6444e52
parentdata spans (diff)
downloadHomePanel-6bbe2df38ad465ad0151c07397d7d85bf0e841dc.tar.gz
HomePanel-6bbe2df38ad465ad0151c07397d7d85bf0e841dc.tar.bz2
HomePanel-6bbe2df38ad465ad0151c07397d7d85bf0e841dc.zip
rough template for output
-rw-r--r--forecast-file.pl19
1 files changed, 12 insertions, 7 deletions
diff --git a/forecast-file.pl b/forecast-file.pl
index 950b7e0..990dfa9 100644
--- a/forecast-file.pl
+++ b/forecast-file.pl
@@ -4,15 +4,20 @@ use warnings;
use 5.014;
use WebService::ForecastIo::Response;
use Path::Class;
-use Data::Printer;
+use Template;
my $res = WebService::ForecastIo::Response->new(file($ARGV[0])->slurp);
-p $res;
+my $t = Template->new;
+$t->process(\*DATA,{f=>$res})
+ or die $t->error;
-my $hourly_summary_spans = $res->hourly->spans_by_string('summary');
+__DATA__
+[% MACRO dtspan BLOCK -%]
+<[% x.start_time.strftime('%H:%M%z') %] - [%x.stop_time.strftime('%H:%M%z') %]> [% x.value %]
+[%- END -%]
+Currently: [% f.currently.summary %] [% f.currently.temperature %]°
+[% f.hourly.summary %]
-p $hourly_summary_spans;
+[% FOREACH x IN f.hourly.spans_by_string('summary'); dtspan(x=x); ' '; END %]
+[% FOREACH x IN f.hourly.spans_by_number('temperature',2); dtspan(x=x); ' '; END %]
-my $hourly_temp_spans = $res->hourly->spans_by_number('temperature',1);
-
-p $hourly_temp_spans;