2020-01-21 14:01:04 -07:00
|
|
|
#! /usr/bin/perl -w
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use JSON;
|
|
|
|
|
2020-01-21 15:10:25 -07:00
|
|
|
my $info = `curl -sm 5 wttr.in/bluffdale?format=j1` or die "Error";
|
2020-01-21 14:01:04 -07:00
|
|
|
|
|
|
|
my $json = decode_json $info or die "Error";
|
|
|
|
|
2020-07-21 10:17:29 -06:00
|
|
|
my $loc = %{$json}{"nearest_area"}->[0]->{"areaName"}->{"value"};
|
2020-01-21 14:01:04 -07:00
|
|
|
my $temp = %{$json}{"current_condition"}->[0]->{"temp_F"};
|
|
|
|
my $windS = %{$json}{"current_condition"}->[0]->{"windspeedMiles"};
|
|
|
|
my $windD = %{$json}{"current_condition"}->[0]->{"winddirDegree"};
|
|
|
|
my $desc = %{$json}{"current_condition"}->[0]->{"weatherDesc"}->[0]->{"value"};
|
|
|
|
|
2020-07-21 10:17:29 -06:00
|
|
|
print $desc.":".$temp.":".$windS.":".$windD.":".$loc;
|