G. Wade Johnson > Weather-Bug-0.25 > Weather::Bug::Weather

Download:
Weather-Bug-0.25.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.25   Source  

NAME ^

Weather::Bug::Weather - Simple class interface for a weather report.

VERSION ^

This document describes Weather::Bug::CompactWeather version 0.25

SYNOPSIS ^

    use Weather::Bug;

    my $wbug = Weather::Bug->new( 'YOURAPIKEYHERE' );
    my $weather = $wbug->get_live_compact_weather( 'HSTMU', 77030 );

    my $temp = $weather->temp();
    my $rain = $weather->rain_today();
    my $wind = $weather->wind_speed();
    my $dir = $weather->wind_dir();
    print "Temperature: $temp\n",
          "Rain: $rain\n",
          "Wind: $wind from $dir\n";

DESCRIPTION ^

The Weather class wraps the concept of a WeatherBug weather report. The WeatherBug API provides two different weather reports: Live Compact, and Live. This object wraps the full form which contains the basic information you may want from a weather observation plus detailed information and some summary information.

INTERFACE ^

The Weather interface provides a factory method that constructs the object from an XML node. It also provides accessor methods for the various pieces of data comprising the weather observation.

Factory Methods

Since the Weather object will almost always be created from an XML stream, this class provides a method for constructing a Weather object from the XML responses.

from_xml

Extract the weather information from an aws:obs node, such as the ones returned by the getLiveWeather WeatherBug request.

$bug - the Weather::Bug object $w - the aws:obs XML node $creator - either a Weather::Bug::Station or a Weather::Bug object.

If we get a Station, use it internally, otherwise we need to parse the XML to create a station object.

Return a new Weather::Bug::Weather object. Dies on failure.

Accessor Methods

The Station object provides accessor methods for the following fields:

date

A DateTime object representing the time of the observation.

station

A Weather::Bug::Station object representing the location of the observation.

aux_temp

A Weather::Bug::Temperature object representing the auxillary temperature.

aux_temp_rate

A Weather::Bug::Temperature object representing rate of change of the auxillary temperature.

dew_point

A Weather::Bug::Temperature object representing the current dew point.

elevation

A Weather::Bug::Quantity object representing the elevation of the WeatherBug station.

feels_like

A Weather::Bug::Temperature object representing what temperature the outside feels like taking into account wind and humidity.

gust_time

A DateTime object repesenting the time of the last recorded gust of wind.

gust_speed

A Weather::Bug::Quantity object representing the speed of the last recorded wind gust.

gust_dir

A string representing the direction of the last wind gust.

humidity

A Weather::Bug::Quantity object representing the current humidity.

humidity_high

A Weather::Bug::Quantity object representing the high humidity for today.

humidity_low

A Weather::Bug::Quantity object representing the low humidity for today.

humidity_rate

A float representing the current change in humidity.

indoor_temp

A Weather::Bug::Temperature object representing the indoor temperature at the site of the WeatherBug station.

indoor_temp_rate

A Weather::Bug::Temperature object representing the rate at which the indoor temperature at the site of the WeatherBug station is changing.

light

A float representing the current light level.

light_rate

A float representing the current change in light level.

moon_phase

A integer representing the current phase of the moon.

moon_phase_img

A URL pointing to an image representing the current moon phase.

pressure

A Weather::Bug::Quantity object representing the current barometric pressure.

pressure_high

A Weather::Bug::Quantity object representing the high barometric pressure for today.

pressure_low

A Weather::Bug::Quantity object representing the low barometric pressure for today.

pressure_rate

A float representing the current change in barometric pressure.

rain_month

A Weather::Bug::Quantity object representing the amount of rain that has fallen this month.

rain_rate

A Weather::Bug::Quantity object representing the amount of rain that has fallen is falling per hour.

rain_rate_max

A Weather::Bug::Quantity object representing the maximum amount of rain that has fallen was falling per hour.

rain_today

A Weather::Bug::Quantity object representing the amount of rain that has fallen this today.

rain_year

A Weather::Bug::Quantity object representing the amount of rain that has fallen this year.

temp

A Weather::Bug::Temperature object representing the current outdoor temperature.

temp_high

A Weather::Bug::Temperature object representing the high temperature for today.

temp_low

A Weather::Bug::Temperature object representing the low temperature for today.

temp_rate

A Weather::Bug::Temperature object representing the change in temperature at the current time.

sunrise

A DateTime object representing the time for today's sunrise.

sunset

A DateTime object representing the time for today's sunset.

wet_bulb

A Weather::Bug::Temperature object representing the current wet-bulb temperature.

wind_speed

A Weather::Bug::Quantity object representing the current wind speed.

wind_speed_avg

A Weather::Bug::Quantity object representing the average wind speed.

wind_dir

A string representing the direction of the current prevailing wind.

wind_dir_avg

A string representing the average direction of the prevailing wind.

DIAGNOSTICS ^

Unable to create a Station localizing the Weather.

The from_xml method is either not passed a Weather::Bug or Weather::Bug::Station object, or we are unable to build a Station object.

CONFIGURATION AND ENVIRONMENT ^

Weather::Bug requires no configuration files or environment variables.

DEPENDENCIES ^

Moose, XML::LibXML.

INCOMPATIBILITIES ^

None reported.

BUGS AND LIMITATIONS ^

No bugs have been reported.

Please report any bugs or feature requests to bug-weather-weatherbug@rt.cpan.org, or through the web interface at http://rt.cpan.org.

AUTHOR ^

G. Wade Johnson <wade@anomaly.org>

LICENCE AND COPYRIGHT ^

Copyright (c) 2008, G. Wade Johnson <wade@anomaly.org>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

DISCLAIMER OF WARRANTY ^

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

syntax highlighting: