File Coverage

blib/lib/WWW/Search/Null/Empty.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 20 100.0


line stmt bran cond sub pod time code
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, L.
27              
28             =cut
29              
30             package WWW::Search::Null::Empty;
31              
32 3     3   3524 use strict;
  3         7  
  3         94  
33 3     3   16 use warnings;
  3         6  
  3         89  
34              
35 3     3   16 use base 'WWW::Search';
  3         5  
  3         726  
36              
37             our
38             $VERSION = 1.11;
39             our
40             $MAINTAINER = q{Martin Thurn };
41              
42             sub _native_setup_search
43             {
44 4     4   21 my($self, $native_query, $native_opt) = @_;
45             } # native_setup_search
46              
47              
48             sub _native_retrieve_some
49             {
50 2     2   10 my $self = shift;
51 2         22 my $response = new HTTP::Response(200,
52             "This is a test of WWW::Search");
53 2         159 $self->{response} = $response;
54             # Explicitly set the number of results:
55 2         6 $self->{'approx_count'} = 0;
56 2         38 return 0;
57             } # native_retrieve_some
58              
59              
60             1;
61              
62             __END__