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