| 1 |
|
| 2 |
=head1 NAME |
| 3 |
|
| 4 |
WWW::Search::Null::Empty - class for testing WWW::Search clients |
| 5 |
|
| 6 |
=head1 SYNOPSIS |
| 7 |
|
| 8 |
use WWW::Search; |
| 9 |
my $oSearch = new WWW::Search('Null::Empty'); |
| 10 |
$oSearch->native_query('Makes no difference what you search for...'); |
| 11 |
my @aoResults = $oSearch->results; |
| 12 |
# You get no results... |
| 13 |
my $oResponse = $oSearch->response; |
| 14 |
# ...But you get an HTTP::Response object with a code of 200 |
| 15 |
|
| 16 |
=head1 DESCRIPTION |
| 17 |
|
| 18 |
This class is a specialization of WWW::Search that returns no hits, |
| 19 |
but no error message. |
| 20 |
|
| 21 |
This module might be useful for testing a client program without |
| 22 |
actually being connected to any particular search engine. |
| 23 |
|
| 24 |
=head1 AUTHOR |
| 25 |
|
| 26 |
Martin 'Kingpin' Thurn, C<mthurn at cpan.org>, L<http://tinyurl.com/nn67z>. |
| 27 |
|
| 28 |
=cut |
| 29 |
|
| 30 |
package WWW::Search::Null::Empty; |
| 31 |
|
| 32 |
use strict; |
| 33 |
use warnings; |
| 34 |
|
| 35 |
use base 'WWW::Search'; |
| 36 |
|
| 37 |
our |
| 38 |
$VERSION = 1.11; |
| 39 |
our |
| 40 |
$MAINTAINER = q{Martin Thurn <[email protected]>}; |
| 41 |
|
| 42 |
sub _native_setup_search |
| 43 |
{ |
| 44 |
my($self, $native_query, $native_opt) = @_; |
| 45 |
} # native_setup_search |
| 46 |
|
| 47 |
|
| 48 |
sub _native_retrieve_some |
| 49 |
{ |
| 50 |
my $self = shift; |
| 51 |
my $response = new HTTP::Response(200, |
| 52 |
"This is a test of WWW::Search"); |
| 53 |
$self->{response} = $response; |
| 54 |
# Explicitly set the number of results: |
| 55 |
$self->{'approx_count'} = 0; |
| 56 |
return 0; |
| 57 |
} # native_retrieve_some |
| 58 |
|
| 59 |
|
| 60 |
1; |
| 61 |
|
| 62 |
__END__ |
| 63 |
|