Skip Menu |

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

Report information
The Basics
Id: 4094
Status: resolved
Worked: 15 min
Priority: 0/
Queue: WWW-Search

People
Owner: MTHURN [...] cpan.org
Requestors: tsuchiya [...] pine.kuee.kyoto-u.ac.jp
Cc:
AdminCc:

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



Subject: approximate_result_count() always returns zero
Hi, When approximate_result_count() is called without calling neither results() nor next_result(), approximate_result_count() always returns zero. use WWW::Search; $engine = new WWW::Search("Backend"); $engine->native_query("keyword"); print $engine->approximate_result_count(); In order to avoid this problem, I propose the attached change. Regards,
--- lib/WWW/Search.pm~ Tue Jul 29 10:25:44 2003 +++ lib/WWW/Search.pm Tue Oct 14 09:09:37 2003 @@ -606,7 +606,7 @@ { my $self = shift; # prime the pump: - $self->retrieve_some() if ($self->{'state'} == SEARCH_BEFORE); + $self->retrieve_some() if ($self->{'state'} == SEARCH_BEFORE or $self->{'state'} == SEARCH_UNDERWAY); return $self->_elem('approx_count', @_); } # approximate_result_count
RT-Send-CC: mthurn [...] verizon.net
Thank you for this report! The fix was a little more complicated than what you proposed, in order to prevent "deep recursion" in certain instances.