NAME

Weather::NWS::TropicalCyclone

SYNOPSIS

use strict;
use warnings;
use Weather::NHC::TropicalCyclone ();

my $nhc = Weather::NHC::TropicalCyclone->new;
$nhc->fetch;

my $storms_ref = $nhc->active_storms;
foreach my $storm (@$storms_ref) {
  print $storm->name . qq{\n};
  my ($text, $advNum, $local_file) = $storm->fetch_publicAdvisory($storm->id.q{.fst});
  print qq{$local_file saved for Advisory $advNum\n};
  print $text;
} 

METHODS

new

Constructor - doesn't do much, but provide a convenient instance for the other provided methods described below.

fetch

Makes an HTTP request to $Weather::NHC::TropicalCyclone::DEFAULT_URL to get the JSON provided by the NHC describing the current set of active storms.

If the JSON is malformed or otherwise can't be parsed, fetch will throw an exception.

Fetch will time out after $Weather::NWS::TropicalCyclone::DEFAULT_TIMEOUT by throwing an exception. In order to disable the alarm, call fetch with a parameter of 0:

$nhc->fetch(0); 
active_storms

Provides an array reference of Weather::NHC::TropicalCyclone::Storm instances, one for each active storm. If there are no storms, the array reference returned is empty (not undef).

Most of the useful functionality related to this JSON data is available through the methods provided by the Weather::NHC::TropicalCyclone::Storm instances returned by this method.

COPYRIGHT and LICENSE

This module is distributed under the same terms as Perl itself.