[SimBot-commits] CVS: simbot/plugins weather.pl,1.88,1.89
Status: Abandoned
Brought to you by:
kstange
|
From: Pete P. <fou...@us...> - 2005-05-14 00:02:53
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7125/plugins Modified Files: weather.pl Log Message: Getting the forecast now times out properly. Would NOAA take a donation of a faster server? Index: weather.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/weather.pl,v retrieving revision 1.88 retrieving revision 1.89 diff -u -d -p -r1.88 -r1.89 --- weather.pl 10 May 2005 02:45:53 -0000 1.88 +++ weather.pl 14 May 2005 00:02:43 -0000 1.89 @@ -808,14 +808,19 @@ sub get_forecast { my $weather = SOAP::Lite->new(uri => $soapAction, proxy => $endpoint); $weather->transport->timeout(8); - my $response = $weather->call( - SOAP::Data->name($method) - => SOAP::Data->type(decimal => $lat )->name('latitude'), - => SOAP::Data->type(decimal => $long )->name('longitude'), - => SOAP::Data->type(date => $startDate)->name('startDate'), - => SOAP::Data->type(integer => $numDays )->name('numDays'), - => SOAP::Data->type(string => $format )->name('format') - ); + my $response; + if(!eval { + $response = $weather->call( + SOAP::Data->name($method) + => SOAP::Data->type(decimal => $lat )->name('latitude'), + => SOAP::Data->type(decimal => $long )->name('longitude'), + => SOAP::Data->type(date => $startDate)->name('startDate'), + => SOAP::Data->type(integer => $numDays )->name('numDays'), + => SOAP::Data->type(string => $format )->name('format') + ); + }) { + return 'I cannot contact NOAA. Please try again later.'; + } if ($response->fault) { return 'Something unexpected happened: ' . $response->faultstring; |