[SimBot-commits] CVS: simbot/plugins weather.pl,1.84,1.85
Status: Abandoned
Brought to you by:
kstange
|
From: Pete P. <fou...@us...> - 2005-05-09 21:34:30
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1707/plugins Modified Files: weather.pl Log Message: Using ForceArray properly helps. Also, this code worked before... I need to see more feeds to know this change will continue working, in case some feeds don't use cap:area. Index: weather.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/weather.pl,v retrieving revision 1.84 retrieving revision 1.85 diff -u -d -p -r1.84 -r1.85 --- weather.pl 9 May 2005 03:12:48 -0000 1.84 +++ weather.pl 9 May 2005 21:34:19 -0000 1.85 @@ -735,7 +735,7 @@ sub got_alerts { my $cap_alert; - if (!eval { $cap_alert = XMLin($raw_xml, NormaliseSpace => 2, ForceArray => ('cap:info')); }) { + if (!eval { $cap_alert = XMLin($raw_xml, NormaliseSpace => 2, ForceArray => ['cap:info']); }) { &SimBot::debug(3, "weather: XML parse error for alerts\n"); &SimBot::debug(4, "weather: XML parser failure: $@"); @@ -749,9 +749,11 @@ sub got_alerts { my @alerts; my @alerts_link; + foreach my $cur_cap_info (@{$cap_alert->{'cap:info'}}) { - if(defined $cur_cap_info->{'geocode'} - && $cur_cap_info->{'geocode'} == $geocode) + warn $cur_cap_info->{'cap:area'}->{'cap:geocode'} . " $geocode"; + if(defined $cur_cap_info->{'cap:area'}->{'cap:geocode'} + && $cur_cap_info->{'cap:area'}->{'cap:geocode'} == $geocode) { # We have a warning! push(@alerts, $cur_cap_info->{'cap:event'}); |