Subject: | Regex broke recently; patch included |
I have fixed the regex, because Google changed the HTML a bit.
Also, I removed the line where it prints the page source if the regex
fails, and removed verbose flag from the regex.
-Zach Hauri
--- Time.pm 2010-03-06 22:43:41.000000000 +0000
+++ lib/WWW/Google/Time.pm 2010-05-20 08:04:05.380114000 +0000
@@ -61,17 +61,8 @@
# <b>Time</b> in <b>Toronto</b>, Ontario</table>
@data{ qw/time day_of_week time_zone where/ } = $response->content
- =~ m{<img \s+ border=0 \s+ width=40 \s+ height=30 \s+ valign=middle
-
- \s+
src="http://www[.]google[.]com/chart\?chs=40x30&chc=localtime\S+
-
- \s+ alt=""><td \s+ valign=(?:top|middle)><em>([^<]+)<\/em> \s+
(\S+) \s+ \( (\w+) \) \s+ -
-\s+ <em>Time<\/em>
-
- \s+ in \s+ (.+?)<(br|/table)>
-
- }x or do {
- print "\n\n\n" . $response->content . "\n\n\n";
+ =~ m{<td valign="?(?:top|middle)"?><em>([^<]+)<\/em> (\S+)
\((\w+)\) - <em>Time<\/em> in (.+?)<(?:\/table|br)>}
+ or do {
return $self->_set_error("Could not find time data for that
location");
};