Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the WWW-Google-Time CPAN distribution.

Report information
The Basics
Id: 57651
Status: resolved
Priority: 0/
Queue: WWW-Google-Time

People
Owner: Nobody in particular
Requestors: z.hauri [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



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&amp;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"); };
Hey, For some reason when I tried your patch, I didn't get any luck. In any case, the module's fixed now and I've just shipped version 0.0115 to CPAN. Thanks!
From: Zach Hauri
On Wed Jun 02 17:13:16 2010, ZOFFIX wrote: Show quoted text
> Hey, > > For some reason when I tried your patch, I didn't get any luck. > > In any case, the module's fixed now and I've just shipped version 0.0115 > to CPAN. > > Thanks!
I just tried a CPAN upgrade WWW::Google::Time and it failed on make test: Running make test PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/00-load.t ....... 1/14 # Testing WWW::Google::Time 0.0115, Perl 5.008008, /usr/bin/perl t/00-load.t ....... 7/14 Bailout called. Further testing stopped: Did not find time data when we should have. Module seems to be broken. Please email to zoffix@cpan.org FAILED--Further testing stopped: Did not find time data when we should have. Module seems to be broken. Please email to zoffix@cpan.org make: *** [test_dynamic] Error 255 ZOFFIX/WWW-Google-Time-0.0115.tar.gz make test -- NOT OK //hint// to see the cpan-testers results for installing this module, try: reports ZOFFIX/WWW-Google-Time-0.0115.tar.gz Running make install make test had returned bad status, won't install without force Failed during this command: ZOFFIX/WWW-Google-Time-0.0115.tar.gz : make_test NO I'm still using the version that has the patch from comment 1, and it's working fine. Could you describe the problem with the patch I posted? -Zach Hauri
I created a new patch against the new version. I applied the patch and ran make test again: Running make test PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/00-load.t ....... 1/14 # Testing WWW::Google::Time 0.0115, Perl 5.008008, /usr/bin/perl t/00-load.t ....... ok t/pod-coverage.t .. skipped: Test::Pod::Coverage 1.08 required for testing POD coverage t/pod.t ........... skipped: Test::Pod 1.22 required for testing POD(Can't locate Test/Pod.pm in @INC (@INC contains: /root/.cpan/build/WWW-Google-Time-0.0115-LDvhoP/blib/lib /root/.cpan/build/WWW-Google-Time-0.0115-LDvhoP/blib/arch /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at (eval 3) line 2. All tests successful. Files=3, Tests=14, 3 wallclock secs ( 0.11 usr 0.08 sys + 0.43 cusr 0.37 csys = 0.99 CPU) Result: PASS ZOFFIX/WWW-Google-Time-0.0115.tar.gz make test -- OK I noticed when I posted the patch above, it created extra line breaks, which might have screwed up the patching. Hopefully the attached patch doesn't have that problem. -Zach Hauri
Subject: patch_WWW-Google-Time-0.0115.diff
--- Time.pm 2010-06-02 16:09:30.000000000 -0500 +++ /usr/local/share/perl/5.8.8/WWW/Google/Time.pm 2010-06-02 19:47:07.000000000 -0500 @@ -61,12 +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+ src="/images/icons/onebox/clock-40[.]gif[^>]*><td \s+ valign=(?:top|middle)><em>([^<]+)<\/em> \s+ (\S+) \s+ \( (\w+) \) \s+ - -\s+ <em>Time<\/em> - - \s+ in \s+ (.+?)<(?:br|/table)> - - }x or do { + =~ m{<td valign="?(?:top|middle)"?><em>([^<]+)<\/em> (\S+) \((\w+)\) - <em>Time<\/em> in (.+?)<(?:\/table|br)>} + or do { # print "\n\n\n" . $response->content . "\n\n\n"; return $self->_set_error("Could not find time data for that location"); };
Ah, I see why the new version broke already - my regex included the clock, which changes when it's night time. Your new patch worked great. Applied it and shipped version 0.0116 to CPAN. Thanks!