You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
997 B
28 lines
997 B
#!/usr/bin/env perl
|
|
|
|
use warnings;
|
|
use strict;
|
|
use Yahoo::Weather;
|
|
use Data::Dumper;
|
|
|
|
my $default_zip = 99156;
|
|
my $w = Yahoo::Weather->new;
|
|
my $weather = $w->getWeatherByLocation(shift || $default_zip, 'f');
|
|
warn Dumper [ $w ];
|
|
my $city = $weather->{LocationDetails}{city};
|
|
my $region = $weather->{LocationDetails}{region};
|
|
my $current = $weather->{CurrentObservation};
|
|
my $current_temp = $current->{temp};
|
|
my $current_date = $current->{date};
|
|
my $current_text = $current->{text};
|
|
|
|
my ($sunrise, $sunset) = ($weather->{Astronomy}{sunrise},$weather->{Astronomy}{sunset});
|
|
my ($day1,$day2) = @{ $weather->{TwoDayForecast} };
|
|
|
|
printf "${current_temp}F, $current_text\n";
|
|
#printf "$city, $region\n"; # $current_date\n";
|
|
printf "Light:($sunrise,$sunset)\n";
|
|
|
|
printf "%s %s: %s-%sF %s\n%s %s: %s-%sF %s\n",
|
|
$day1->{day}, (split(' ',$day1->{date}))[0], $day1->{low}, $day1->{high}, $day1->{text},
|
|
$day2->{day}, (split(' ',$day2->{date}))[0], $day2->{low}, $day2->{high}, $day2->{text};
|
|
|