I used one of the CPAN weather grabbers with mixed results.Often the ports would time out when I used the module as written. My solution was to dupe the .pm and localize it to pull only from the Los Angeles NOAA station instead of the central/national one. This one had a lot less traffic, and I haven't seen any lost results since I made the switch.
In case anyone is interested, I modified Geo::WeatherNOAA as Geo::LAWeatherNOAA.
In the subroutine get_city_zone I changed my $URL = $URL_BASE . lc $state . '/zone.html'; to my $URL = 'http://www.nwsla.noaa.gov/zones/LAXZFPLOX'; and that took care of just about everything.
| [reply] |
This worked really well the first time. Then I ran it again with a different zip code and it crashed thusly:
IO::Socket::INET: Bad peer address at D:\FileBin\weather.pl line 36
Bad file descriptor at D:\FileBin\weather.pl line 36.
Line 36 is this one:$remote = new IO::Socket::INET ((I think) | [reply] [d/l] |
I believe this is caused when yahoo splits that
zipcode / city up into differnt weather reports or
the city is found in multiple states.
On yahoo's site it lists options of differnt locations
in such instances and the users is expected to drill down
by clicking one of the links.
I've added an if statement to make it quit nicely.
Maybe I'll reqrite it using one of the modules KM has
pointed out.
-scribe
| [reply] |