NAME

Ham::Reference::Solar - Get basic solar data from the web that's useful for Amateur Radio applications.

VERSION

Version 0.01

SYNOPSIS

use Ham::Reference::Solar;

my $solar = new Ham::Reference::Solar;
die $solar->error_message if $solar->is_error;

# access data with a hash ref

foreach (sort keys %{$solar->get_hash_ref})
{
   print "$_ = $solar->{$_}\n";
}

# or access data with the get method

foreach (sort @{$solar->all_item_names})
{
   print "$_ = ".$solar->get($_)."\n";
}

DESCRIPTION

The Ham::Reference::Solar module makes use of WM7D's Solar Resource Page to "scrape" (parse) data and return it for your use in either a hash reference or through the get() method.

Please note that this module depends on the current formatting of the web site, and if it changes, this module will no longer work until I have a chance to update it.

CONSTRUCTOR

new()

Usage    : my $solar = Ham::Reference::Solar->new();
Function : creates a new Ham::Reference::Solar object
Returns  : A Ham::Reference::Solar object
Args     : an anonymous hash:
           key       required?   value
           -------   ---------   -----
           timeout   no          an integer of seconds for the call
                                 to the web site of data.  default = 10

METHODS

get()

Usage    : my $sunspots = $solar->get( $data_item_name );
Function : gets a single item of solar data
Returns  : a Geo::Google object
Args     : see the list of data items below

set()

Usage    : $solar->set( $data_item_name, $new_value );
Function : gets a single item of solar data
Returns  : n/a
Args     : data-item: see the list of data items below
           data-value: any value with which you'd like to override the actual value

get_hash_ref()

Usage    : my $hashref = $solar->get_hash_ref();
Function : get all current solar data
           (this is probably the easiest way to access data)
Returns  : a hash reference
Args     : n/a

all_item_names()

Usage    : my $arrayref = $solar->all_item_names();
Function : get an array reference of all solar data items available
           from the object
Returns  : an array reference
Args     : n/a

is_error()

Usage    : if ( $solar->is_error() )
Function : test for an error if one was returned from the call to the web site
Returns  : a string, the error message
Args     : n/a

error_message()

Usage    : my $err_msg = $solar->error_message();
Function : if there was an error message when trying to call the site, this is it
Returns  : a string, the error message
Args     : n/a

DATA ITEMS

The following items are available from the object. Use them with the get() method or access them with the get_hash_ref() method.

sfi

Solar flux index.

a-index

The A-index number.

a-index-text

The text interpretation of the A-index.

k-index

The K-index number.

k-index-text

The text interpretation of the K-index.

forecast

Brief text forecast for the next 24 hours

summary

Bried text summary for the past 24 hours.

sunspots

Current sunspot count.

image

URL for the current solar image from the Solar and Heliosphereic Observatory.

image_thumbnail

URL for the current thumbnail sized solar image from the Solar and Heliosphereic Observatory.

time

Time of the last update.

TODO

  • Convert date to something more useful.

  • Add more data items.

  • Improve documentation and error checking.

  • Maybe improve the synopsis.

SEE ALSO

This module gets its data from WM7D's Solar Resource Page at http://www.wm7d.net/hamradio/solar. Thanks to Mark A. Downing!

AUTHOR

Brad McConahay N8QQ <brad@n8qq.com>

COPYRIGHT AND LICENSE

Copyright (C) 2008 by Brad McConahay N8QQ

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.