File Coverage

blib/lib/WWW/Search/Ebay/Motors.pm
Criterion Covered Total %
statement 15 26 57.6
branch 0 2 0.0
condition 0 2 0.0
subroutine 5 7 71.4
pod n/a
total 20 37 54.0


line stmt bran cond sub pod time code
1              
2             # $Id: Motors.pm,v 1.20 2014-09-02 01:50:28 Martin Exp $
3              
4             =head1 NAME
5              
6             WWW::Search::Ebay::Motors - backend for searching eBay Motors
7              
8             =head1 SYNOPSIS
9              
10             use WWW::Search;
11             my $oSearch = new WWW::Search('Ebay::Motors');
12             my $sQuery = WWW::Search::escape_query("Buick Star Wars");
13             $oSearch->native_query($sQuery);
14             while (my $oResult = $oSearch->next_result())
15             { print $oResult->url, "\n"; }
16              
17             =head1 DESCRIPTION
18              
19             This class is a Ebay Motors specialization of WWW::Search.
20             It handles making and interpreting Ebay searches
21             F.
22              
23             This class exports no public interface; all interaction should
24             be done through L objects.
25              
26             =head1 NOTES
27              
28             Same as L.
29              
30             =head1 OPTIONS
31              
32             Same as L.
33              
34             =head1 SEE ALSO
35              
36             To make new back-ends, see L.
37              
38             =head1 CAVEATS
39              
40             =head1 BUGS
41              
42             Please tell the author if you find any!
43              
44             =head1 AUTHOR
45              
46             Martin 'Kingpin' Thurn, C, L.
47              
48             =head1 LEGALESE
49              
50             Copyright (C) 1998-2009 Martin 'Kingpin' Thurn
51              
52             THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
53             WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
54             MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
55              
56             =cut
57              
58             #####################################################################
59              
60             package WWW::Search::Ebay::Motors;
61              
62 1     1   2626 use strict;
  1         2  
  1         22  
63 1     1   5 use warnings;
  1         1  
  1         23  
64              
65 1     1   4 use Carp;
  1         1  
  1         50  
66 1     1   5 use Data::Dumper;
  1         2  
  1         37  
67 1     1   4 use base 'WWW::Search::Ebay';
  1         2  
  1         259  
68             our
69             $VERSION = do { my @r = (q$Revision: 1.20 $ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r };
70             our $MAINTAINER = 'Martin Thurn ';
71              
72             sub _native_setup_search
73             {
74 0     0     my ($self, $native_query, $rhOptsArg) = @_;
75 0   0       $rhOptsArg ||= {};
76 0 0         if (ref($rhOptsArg) ne 'HASH')
77             {
78 0           carp " --- second argument to _native_setup_search should be hashref";
79 0           return;
80             } # unless
81             # As of 2013-03:
82             # http://motors.shop.ebay.com/eBay-Motors-/6000/i.html?_nkw=bugatti&_trksid=p2050890.m570.l1313&_rdc=1
83 0           $rhOptsArg->{search_host} = 'http://motors.shop.ebay.com';
84 0           $rhOptsArg->{search_path} = '/eBay-Motors-/6000/i.html';
85             $self->{_options} = {
86             _nkw => $native_query,
87             _armrs => 1,
88             # _trksid => 'p2050890.m570.l1313',
89             # Turn off JavaScript:
90             _jsoff => 1,
91             # Search AUCTIONS ONLY:
92             LH_Auction => 1,
93             _ipg => $self->{_hits_per_page},
94 0           _rdc => 1,
95             };
96 0           return $self->SUPER::_native_setup_search($native_query, $rhOptsArg);
97             } # _native_setup_search
98              
99             sub _columns
100             {
101 0     0     my $self = shift;
102 0           return qw( price bids junk enddate );
103             } # _columns
104              
105             1;
106              
107             __END__