Bob Ernst > Weather-Com > Weather::Com::DayForecast

Download:
Weather-Com-2.0.0.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  5
Open  1
View/Report Bugs
Module Version: 1.002   Source  

NAME ^

Weather::Com::DayForecast - class representing a forecast for one day

SYNOPSIS ^

  [...]
    
  my @locations = $weather_finder->find('Heidelberg');

  my $forecast = $locations[0]->forecast();
  my $tomorrow = $forecast->day(1);

  print "Forecast for tomorrow:\n";
  print " - tomorrow it's the ", $tomorrow->date()->date(), "\n";  
  print " - sunrise will be at ", $tomorrow->sunrise()->time(), "\n";  
  print " - maximum temperature will be ", $tomorrow->high(), "\n";  

DESCRIPTION ^

Via Weather::Com::DayForecast objects one can access the weather forecast for one specific day.

This class will not be updated automatically with each call to one of its methods. You need to call a method of your Weather::Com::Forecast object to get updated objects.

CONSTRUCTOR ^

You usually would not construct an object of this class yourself. This is implicitely done when you call the day(number of day) or the all() method of a Weather::Com::Forecast object.

METHODS ^

date()

Returns a Weather::Com::DateTime object containing the date the forecast is for.

high()

Returns the maximum temperature that will be reached at daytime.

For day 0 (today), this will be 'N/A' when it's after noon...

There is a bug in weather.com's date and time mathematics: If you are asking for a location's forecast day 0 and it's short after midnight, day 0 will be "yesterday" and you'll get both, yesterday's daytime forecast and night forecast!

I have not investigated this issue further, yet. If anyone has, please inform me!

low()

Returns the minimum temperature that will be reached at night.

sunrise()

Returns a Weather::Com::DateTime object containing the time of sunrise.

sunset()

Returns a Weather::Com::DateTime object containing the time of sunset.

day()

Returns a Weather::Com::DayPart object with all data belonging to the daytime.

For day 0 (today), this will be undef when it's after noon...

There is a bug in weather.com's date and time mathematics: If you are asking for a location's forecast day 0 and it's short after midnight, day 0 will be "yesterday" and you'll get both, yesterday's daytime forecast and night forecast!

I have not investigated this issue further, yet. If anyone has, please inform me!

night()

Returns a Weather::Com::DayPart object with all data belonging to the night.

AUTHOR ^

Thomas Schnuecker, <thomas@schnuecker.de>

COPYRIGHT AND LICENSE ^

Copyright (C) 2004-2009 by Thomas Schnuecker

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

The data provided by weather.com and made accessible by this OO interface can be used for free under special terms. Please have a look at the application programming guide of weather.com (http://www.weather.com/services/xmloap.html)!

syntax highlighting: