| 1 | # EbayUK/ByEndDate.pm | ||||||||||||
| 2 | # by Martin Thurn | ||||||||||||
| 3 | # $Id: ByEndDate.pm,v 1.1 2003-02-06 23:35:18-05 kingpin Exp kingpin $ | ||||||||||||
| 4 | |||||||||||||
| 5 | =head1 NAME | ||||||||||||
| 6 | |||||||||||||
| 7 | WWW::Search::EbayUK::ByEndDate - backend for searching www.ebay.co.uk, with results sorted with "items ending first" | ||||||||||||
| 8 | |||||||||||||
| 9 | =head1 SYNOPSIS | ||||||||||||
| 10 | |||||||||||||
| 11 | use WWW::Search; | ||||||||||||
| 12 | my $oSearch = new WWW::Search('EbayUK::ByEndDate'); | ||||||||||||
| 13 | my $sQuery = WWW::Search::escape_query("C-10 carded Yakface"); | ||||||||||||
| 14 | $oSearch->native_query($sQuery); | ||||||||||||
| 15 | while (my $oResult = $oSearch->next_result()) | ||||||||||||
| 16 | { print $oResult->url, "\n"; } | ||||||||||||
| 17 | |||||||||||||
| 18 | =head1 DESCRIPTION | ||||||||||||
| 19 | |||||||||||||
| 20 | This class is a Ebay.co.uk specialization of WWW::Search. | ||||||||||||
| 21 | It handles making and interpreting Ebay searches | ||||||||||||
| 22 | F<http://www.ebay.co.uk>. | ||||||||||||
| 23 | |||||||||||||
| 24 | This class exports no public interface; all interaction should | ||||||||||||
| 25 | be done through L<WWW::Search> objects. | ||||||||||||
| 26 | |||||||||||||
| 27 | =head1 NOTES | ||||||||||||
| 28 | |||||||||||||
| 29 | The search is done against CURRENT running auctions only. | ||||||||||||
| 30 | |||||||||||||
| 31 | The query is applied to TITLES only. | ||||||||||||
| 32 | |||||||||||||
| 33 | The results are ordered auctions ending soon first (order of | ||||||||||||
| 34 | increasing auction ending date). | ||||||||||||
| 35 | |||||||||||||
| 36 | In the resulting WWW::Search::Result objects, the description field | ||||||||||||
| 37 | consists of a human-readable combination (joined with semicolon-space) | ||||||||||||
| 38 | of the Item Number; number of bids; and high bid amount (or starting | ||||||||||||
| 39 | bid amount). | ||||||||||||
| 40 | |||||||||||||
| 41 | In the WWW::Search::Result objects, the change_date field contains the | ||||||||||||
| 42 | auction ending date & time exactly as returned by ebay.co.uk; this can | ||||||||||||
| 43 | have values like "in 12 mins" or "5d 3h 15m". | ||||||||||||
| 44 | |||||||||||||
| 45 | =head1 SEE ALSO | ||||||||||||
| 46 | |||||||||||||
| 47 | To make new back-ends, see L<WWW::Search>. | ||||||||||||
| 48 | |||||||||||||
| 49 | =head1 CAVEATS | ||||||||||||
| 50 | |||||||||||||
| 51 | =head1 BUGS | ||||||||||||
| 52 | |||||||||||||
| 53 | Please tell the author if you find any! | ||||||||||||
| 54 | |||||||||||||
| 55 | =head1 AUTHOR | ||||||||||||
| 56 | |||||||||||||
| 57 | C<WWW::Search::EbayUK::ByEndDate> was written by Martin Thurn | ||||||||||||
| 58 | (mthurn@cpan.org). | ||||||||||||
| 59 | |||||||||||||
| 60 | C<WWW::Search::EbayUK::ByEndDate> is maintained by Martin Thurn | ||||||||||||
| 61 | (mthurn@cpan.org). | ||||||||||||
| 62 | |||||||||||||
| 63 | =head1 LEGALESE | ||||||||||||
| 64 | |||||||||||||
| 65 | THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED | ||||||||||||
| 66 | WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF | ||||||||||||
| 67 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||||||||||||
| 68 | |||||||||||||
| 69 | =head1 VERSION HISTORY | ||||||||||||
| 70 | |||||||||||||
| 71 | =head2 2.02 | ||||||||||||
| 72 | |||||||||||||
| 73 | Fixed hash vs. array bug? | ||||||||||||
| 74 | |||||||||||||
| 75 | =head2 2.01 | ||||||||||||
| 76 | |||||||||||||
| 77 | First publicly-released version. | ||||||||||||
| 78 | |||||||||||||
| 79 | =cut | ||||||||||||
| 80 | |||||||||||||
| 81 | ##################################################################### | ||||||||||||
| 82 | |||||||||||||
| 83 | package WWW::Search::EbayUK::ByEndDate; | ||||||||||||
| 84 | |||||||||||||
| 85 | 1 | ▶ | use Carp; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 86 | 1 | ▶ | use WWW::Search::EbayUK; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 87 | 1 | @ISA = qw( WWW::Search::EbayUK ); | |||||||||||
| 88 | |||||||||||||
| 89 | 1 | $VERSION = '2.02'; | |||||||||||
| 90 | 1 | $MAINTAINER = 'Martin Thurn <mthurn@cpan.org>'; | |||||||||||
| 91 | |||||||||||||
| 92 | # private | ||||||||||||
| 93 | sub native_setup_search | ||||||||||||
| 94 | 2 | ▶ | { | ||||||||||
|
Subroutine
native_setup_search: called CC=3 SCAR=12.3
Pod
undocumented
| |||||||||||||
| 95 | 2 | my ($self, $native_query, $rhOptsArg) = @_; | |||||||||||
| 96 | 2 | ▶ | $rhOptsArg ||= {}; | ||||||||||
|
Condition50%1/2
$rhOptsArg ||= {}
MC/DC0%0/1
$rhOptsArg ||= {}
$rhOptsArg
Truth table50%1/2
A
A= $rhOptsArg
| |||||||||||||
| 97 | 2 | ▶ | unless (ref($rhOptsArg) eq 'HASH') | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 98 | { | ||||||||||||
| 99 | 0 | carp " --- second argument to native_setup_search should be hashref, not arrayref"; | |||||||||||
| 100 | 0 | return undef; | |||||||||||
| 101 | } # unless | ||||||||||||
| 102 | 2 | $rhOptsArg->{'SortProperty'} = 'MetaEndSort'; | |||||||||||
| 103 | 2 | return $self->SUPER::native_setup_search($native_query, $rhOptsArg); | |||||||||||
| 104 | } # native_setup_search | ||||||||||||
| 105 | |||||||||||||
| 106 | 1 | 1; | |||||||||||
| 107 | |||||||||||||
| 108 | __END__ | ||||||||||||