Ham::Reference::Solar - Get basic solar data from the web that's useful for Amateur Radio applications.
Version 0.03
use Ham::Reference::Solar; my $solar = new Ham::Reference::Solar; die $solar->error_message if $solar->is_error; # access data with a hash reference foreach (sort keys %{$solar->get_hashref}) { print "$_ = $solar->{$_}\n"; } # or access data with the get method foreach (sort @{$solar->all_item_names}) { print "$_ = ".$solar->get($_)."\n"; }
The Ham::Reference::Solar module makes use of WM7D's Solar Resource Page to "scrape" (parse) data and return it for your use.
Ham::Reference::Solar
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.
Usage : my $solar = Ham::Reference::Solar->new(); Function : creates a new Ham::Reference::Solar object Returns : a Ham::Reference::Solar object Args : a hash: key required? value ------- --------- ----- timeout no an integer of seconds to wait for the timeout of the web site default = 10
Usage : my $sunspots = $solar->get( $data_item_name ); Function : gets a single item of solar data Returns : a Ham::Reference::Solar object Args : a single item from the list of data items below
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
Usage : my $hashref = $solar->get_hashref(); Function : get all current solar data (this is probably the easiest way to access data) Returns : a hash reference Args : n/a
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
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
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
The following items are available from the object. Use them with the get() method or access them with the get_hashref() method.
Solar flux index.
The A-index number.
The text interpretation of the A-index.
The K-index number.
The text interpretation of the K-index.
Brief text forecast for the next 24 hours
Bried text summary for the past 24 hours.
Current sunspot count.
URL for the current solar image from the Solar and Heliosphereic Observatory.
URL for the current thumbnail sized solar image from the Solar and Heliosphereic Observatory.
Time of the last update.
Convert date to something more useful.
Add more data items.
Improve documentation and error checking.
Maybe improve the synopsis.
This module gets its data from WM7D's Solar Resource Page at http://www.wm7d.net/hamradio/solar. Thanks to Mark A. Downing!
Brad McConahay N8QQ <brad@n8qq.com>
Ham::Reference::Solar is Copyright (C) 2008-2010 Brad McConahay N8QQ.
This module is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. For details, see the full text of the license in the file LICENSE.
This program is distributed in the hope that it will be useful, but it is provided "as is" and without any express or implied warranties. For details, see the full text of the license in the file LICENSE.
To install Ham::Reference::Solar, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Ham::Reference::Solar
CPAN shell
perl -MCPAN -e shell install Ham::Reference::Solar
For more information on module installation, please visit the detailed CPAN module installation guide.