[SimBot-commits] CVS: simbot/plugins weather.pl,1.92,1.93
Status: Abandoned
Brought to you by:
kstange
|
From: Pete P. <fou...@us...> - 2005-06-21 18:45:25
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28648/plugins Modified Files: weather.pl Log Message: Apparently Geo::METAR calls you names when it crashes. While this doesn't fix the whole crashing bit, at least it removes the name calling. Index: weather.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/weather.pl,v retrieving revision 1.92 retrieving revision 1.93 diff -u -d -p -r1.92 -r1.93 --- weather.pl 10 Jun 2005 12:37:56 -0000 1.92 +++ weather.pl 21 Jun 2005 18:44:42 -0000 1.93 @@ -357,6 +357,12 @@ sub got_metar { if ($raw_metar =~ /NIL$/) { $reply .= " there is no data available"; } else { + # Geo::METAR's error messages are a bit too aggressive... + local $SIG{__DIE__} = sub { + (my $msg = $_[0]) =~ s/You suck. /Geo::METAR says: /; + die $msg; + }; + # Temperature and related details *only* if we have # a temperature! if (defined $m->TEMP_C || $raw_metar =~ m|(M?\d\d)/|) { |