blob: 990dfa933a83714d66a54b92e69a70c44bb7b330 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
use strict; use warnings; use 5.014; use WebService::ForecastIo::Response; use Path::Class; use Template; my $res = WebService::ForecastIo::Response->new(file($ARGV[0])->slurp); my $t = Template->new; $t->process(\*DATA,{f=>$res}) or die $t->error; __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 %] [% 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 %]
|