WWW-Search-Ebay-3.031/0000755000175000017500000000000012207530063013631 5ustar martinmartinWWW-Search-Ebay-3.031/MANIFEST0000644000175000017500000000130012161737041014760 0ustar martinmartinChanges inc/Module/Install.pm inc/Module/Install/Base.pm inc/Module/Install/Can.pm inc/Module/Install/Fetch.pm inc/Module/Install/Makefile.pm inc/Module/Install/Metadata.pm inc/Module/Install/Win32.pm inc/Module/Install/WriteAll.pm lib/WWW/Search/Ebay.pm lib/WWW/Search/Ebay/Auctions.pm lib/WWW/Search/Ebay/BuyItNow.pm lib/WWW/Search/Ebay/ByEndDate.pm lib/WWW/Search/Ebay/BySellerID.pm lib/WWW/Search/Ebay/Category.pm lib/WWW/Search/Ebay/Motors.pm lib/WWW/Search/Ebay/Stores.pm LICENSE Makefile.PL MANIFEST This list of files META.yml MYMETA.json MYMETA.yml README t/buyitnow.t t/bysellerid.t t/category.t t/coverage.t t/ebay.t t/enddate.t t/itemnumber.t t/motors.t t/pod-coverage.t t/pod.t t/stores.t WWW-Search-Ebay-3.031/lib/0000755000175000017500000000000012207530063014377 5ustar martinmartinWWW-Search-Ebay-3.031/lib/WWW/0000755000175000017500000000000012207530063015063 5ustar martinmartinWWW-Search-Ebay-3.031/lib/WWW/Search/0000755000175000017500000000000012207530063016270 5ustar martinmartinWWW-Search-Ebay-3.031/lib/WWW/Search/Ebay.pm0000644000175000017500000011222412207527016017514 0ustar martinmartin # $Id: Ebay.pm,v 2.262 2013/08/21 01:15:16 Martin Exp $ =head1 NAME WWW::Search::Ebay - backend for searching www.ebay.com =head1 SYNOPSIS use WWW::Search; my $oSearch = new WWW::Search('Ebay'); my $sQuery = WWW::Search::escape_query("C-10 carded Yakface"); $oSearch->native_query($sQuery); while (my $oResult = $oSearch->next_result()) { print $oResult->url, "\n"; } =head1 DESCRIPTION This class is a Ebay specialization of L. It handles making and interpreting Ebay searches F. This class exports no public interface; all interaction should be done through L objects. =head1 NOTES The search is done against CURRENT running AUCTIONS only. (NOT completed auctions, NOT eBay Stores items, NOT Buy-It-Now only items.) (If you want to search completed auctions, use the L module.) (If you want to search eBay Stores, use the L module.) The query is applied to TITLES only. This module can return only the first 200 results matching your query. In the resulting L objects, the description() field consists of a human-readable combination (joined with semicolon-space) of the Item Number; number of bids; and high bid amount (or starting bid amount). In the resulting L objects, the end_date() field contains a human-readable DTG of when the auction is scheduled to end (in the form "YYYY-MM-DD HH:MM TZ"). If environment variable TZ is set, the time will be converted to that timezone; otherwise the time will be left in ebay.com's default timezone (US/Pacific). In the resulting L objects, the bid_count() field contains the number of bids as an integer. In the resulting L objects, the bid_amount() field is a string containing the high bid or starting bid as a human-readable monetary value in seller-native units, e.g. "$14.95" or "GBP 6.00". In the resulting L objects, the category() field contains the Ebay category number. In the resulting L objects, the sold() field will be non-zero if the item has already sold. (Only if you're using WWW::Search::Ebay::Completed) After a successful search, your search object will contain an element named 'categories' which will be a reference to an array of hashes containing names and IDs of categories and nested subcategories, and the count of items matching your query in each category and subcategory. (Special thanks to Nick Lokkju for this code!) For example: $oSearch->{category} = [ { 'ID' => '1', 'Count' => 19, 'Name' => 'Collectibles', 'Subcategory' => [ { 'ID' => '13877', 'Count' => 11, 'Name' => 'Historical Memorabilia' }, { 'ID' => '11450', 'Count' => 1, 'Name' => 'Clothing, Shoes & Accessories' }, ] }, { 'ID' => '281', 'Count' => 1, 'Name' => 'Jewelry & Watches', } ]; If your query string happens to be an eBay item number, (i.e. if ebay.com redirects the query to an auction page), you will get back one WWW::Search::Result without bid or price information. =head1 OPTIONS =over =item Limit search by price range Contributed by Brian Wilson: $oSearch->native_query($sQuery, { _mPrRngCbx=>'1', _udlo=>$minPrice, _udhi=>$maxPrice, } ); =back =head1 PUBLIC METHODS OF NOTE =over =cut package WWW::Search::Ebay; use strict; use warnings; use base 'WWW::Search'; use constant DEBUG_DATES => 0; use constant DEBUG_COLUMNS => 0; use Carp (); use CGI; use Data::Dumper; # for debugging only use Date::Manip; &Date_Init('TZ=US/Pacific') unless (defined($ENV{TZ}) && ($ENV{TZ} ne '')); use HTML::TreeBuilder; use LWP::Simple; use WWW::Search qw( generic_option strip_tags ); # We need the version that has the sold() method: use WWW::SearchResult 2.072; use WWW::Search::Result; our $VERSION = do { my @r = (q$Revision: 2.262 $ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r }; our $MAINTAINER = 'Martin Thurn '; my $cgi = new CGI; sub _native_setup_search { my ($self, $native_query, $rhOptsArg) = @_; # Set some private variables: $self->{_debug} ||= $rhOptsArg->{'search_debug'}; $self->{_debug} = 2 if ($rhOptsArg->{'search_parse_debug'}); $self->{_debug} ||= 0; my $DEFAULT_HITS_PER_PAGE = 200; $self->{'_hits_per_page'} = $DEFAULT_HITS_PER_PAGE; $self->user_agent('non-robot'); $self->agent_name('Mozilla/5.0 (compatible; Mozilla/4.0; MSIE 6.0; Windows NT 5.1; Q312461)'); $self->{'_next_to_retrieve'} = 0; $self->{'_num_hits'} = 0; # As of 2013-03-01 (probably much before that, but first time I # looked at it in quite a while):

To use our basic experience # which does not require JavaScript, click # here.

$self->{search_host} ||= 'http://www.ebay.com'; # as of 2013-03-01 $self->{search_host} ||= 'http://search.ebay.com'; $self->{search_path} ||= '/sch/i.html'; # as of 2013-03-01 $self->{search_path} ||= '/ws/search/SaleSearch'; if (!defined($self->{_options})) { # http://shop.ebay.com/items/_W0QQLHQ5fBINZ1?_nkw=trinidad+flag&_sacat=0&_fromfsb=&_trksid=m270.l1313&_odkw=burkina+faso+flag&_osacat=0 $self->{_options} = { satitle => $native_query, # Search AUCTIONS ONLY: sasaleclass => 1, # Display item number explicitly: socolumnlayout => 2, # Do not convert everything to US$: socurrencydisplay => 1, sorecordsperpage => $self->{_hits_per_page}, _ipg => $self->{_hits_per_page}, # Display absolute times, NOT relative times: sotimedisplay => 0, # Use the default columns, NOT anything the # user may have customized (which would come # through via cookies): socustoverride => 1, # Output basic HTML, not JavaScript: _armrs => 1, }; $self->{_options} = { _nkw => $native_query, _armrs => 1, # Turn off JavaScript: _jsoff => 1, # Search AUCTIONS ONLY: LH_Auction => 1, _ipg => $self->{_hits_per_page}, # Which page are we on: # _from => 2, # }; } # if if (defined($rhOptsArg)) { # Copy in new options. foreach my $key (keys %$rhOptsArg) { # print STDERR " DDD inspecting option $key..."; if (WWW::Search::generic_option($key)) { # print STDERR "promote & delete\n"; $self->{$key} = $rhOptsArg->{$key} if defined($rhOptsArg->{$key}); delete $rhOptsArg->{$key}; } else { # print STDERR "copy\n"; $self->{_options}->{$key} = $rhOptsArg->{$key} if defined($rhOptsArg->{$key}); } } # foreach } # if # Clear the list of results per category: $self->{categories} = []; # Finally, figure out the url. $self->{_next_url} = $self->{'search_host'} . $self->{'search_path'} .'?'. $self->hash_to_cgi_string($self->{_options}); } # _native_setup_search =item user_agent_delay Introduce a few-seconds delay to avoid overwhelming the server. =cut sub user_agent_delay { my $self = shift; # return; my $iSecs = int(3 + rand(3)); print STDERR " DDD sleeping $iSecs seconds...\n" if (0 < $self->{_debug}); sleep($iSecs); } # user_agent_delay =item need_to_delay Controls whether we do the delay or not. =cut sub need_to_delay { 1; } # need_to_delay =item preprocess_results_page Grabs the eBay Official Time so that when we parse the DTG from the HTML, we can convert / return exactly what eBay means for each one. =cut sub preprocess_results_page { my $self = shift; my $sPage = shift; if (25 < $self->{_debug}) { # print STDERR Dumper($self->{response}); # For debugging: print STDERR $sPage; exit 88; } # if my $sTitle = $self->{response}->header('title') || ''; my $qrTitle = $self->_title_pattern; if ($sTitle =~ m!$qrTitle!) { # print STDERR " DDD got a Title: ==$sTitle==\n"; # This search returned a single auction item page. We do not need # to fetch eBay official time. } # if else { # Use the UserAgent object in $self to fetch the official ebay.com time: $self->{_ebay_official_time} = 'now'; # my $sPageDate = get('http://cgi1.ebay.com/aw-cgi/eBayISAPI.dll?TimeShow') || ''; my $sPageDate = $self->http_request(GET => 'http://viv.ebay.com/ws/eBayISAPI.dll?EbayTime')->content || ''; if ($sPageDate eq '') { die " EEE could not fetch official eBay time"; } else { my $tree = HTML::TreeBuilder->new; $tree->utf8_mode('true'); $tree->parse($sPageDate); $tree->eof; my $s = $tree->as_text; # print STDERR " DDD official time =====$s=====\n"; if ($s =~ m!The official eBay Time is now:(.+?(P[SD]T))\s*Pacific\s!i) { my ($sDateRaw, $sTZ) = ($1, $2); DEBUG_DATES && print STDERR " DDD official time raw ==$sDateRaw==\n"; # Apparently, ParseDate() automatically converts to local timezone: my $date = ParseDate($sDateRaw); DEBUG_DATES && print STDERR " DDD official time cooked ==$date==\n"; $self->{_ebay_official_time} = $date; } # if } # else } # else return $sPage; # Ebay used to send malformed HTML: # my $iSubs = 0 + ($sPage =~ s!!!gi); # print STDERR " DDD deleted $iSubs extraneous tags\n" if 1 < $self->{_debug}; } # preprocess_results_page sub _cleanup_url { my $self = shift; my $sURL = shift() || ''; # Make sure we don't return two different URLs for the same item: $sURL =~ s!&rd=\d+!!; $sURL =~ s!&category=\d+!!; $sURL =~ s!&ssPageName=[A-Z0-9]+!!; return $sURL; } # _cleanup_url sub _format_date { my $self = shift; return UnixDate(shift, '%Y-%m-%d %H:%M %Z'); } # _format_date sub _bidcount_as_text { my $self = shift; my $hit = shift; my $iBids = $hit->bid_count || 'no'; my $s = "$iBids bid"; $s .= 's' if ($iBids ne '1'); $s .= '; '; } # _bidcount_as_text sub _bidamount_as_text { my $self = shift; my $hit = shift; my $iPrice = $hit->bid_amount || 'unknown'; my $sDesc = ''; $sDesc .= $hit->bid_count ? 'current' : 'starting'; $sDesc .= " bid $iPrice"; } # _bidamount_as_text sub _create_description { my $self = shift; my $hit = shift; my $iItem = $hit->item_number || 'unknown'; my $sWhen = shift() || 'current'; # print STDERR " DDD _c_d($iItem, $iBids, $iPrice, $sWhen)\n"; my $sDesc = "Item \043$iItem; ". $self->_bidcount_as_text($hit); $sDesc .= $self->_bidamount_as_text($hit); return $sDesc; } # _create_description sub _parse_price { my $self = shift; my $oTDprice = shift; my $hit = shift; return 0 unless (ref $oTDprice); my $s = $oTDprice->as_HTML; if (DEBUG_COLUMNS || (1 < $self->{_debug})) { print STDERR " DDD try TDprice ===$s===\n"; } # if if ($oTDprice->attr('class') =~ m'\bebcBid\b') { # If we see this, we must have been searching for Stores items # but we ran off the bottom of the Stores item list and ran # into the list of "other" items. return 1; # We could probably return 0 to abandon the rest of the page, but # maybe just maybe we hit this because of a parsing glitch which # might correct itself on the next TD. } # if if ($oTDprice->attr('class') !~ m'\b(ebcPr|prices|prc)\b') { # If we see this, we probably were searching for Store items # but we ran off the bottom of the Store item list and ran # into the list of Auction items. return 0; # There is a separate backend for searching Auction items! } # if if ($oTDprice->look_down(_tag => 'span', class => 'ebSold')) { # This item sold, even if it had no bids (i.e. Buy-It-Now) $hit->sold(1); } # if if (my $oChild = $oTDprice->look_down(_tag => 'div', itemprop => 'price')) { # As of 2013-03, we need to separate out the price and the bid: $oTDprice = $oChild; } # if my $iPrice = $oTDprice->as_text; print STDERR " DDD raw iPrice ===$iPrice===\n" if (DEBUG_COLUMNS || (1 < $self->{_debug})); $iPrice =~ s!£!GBP!; # Convert nbsp to regular space: $iPrice =~ s!\240!\040!g; # I don't know why there are sometimes weird characters in there: $iPrice =~ s!Â!!g; $iPrice =~ s!Â!!g; my $currency = $self->_currency_pattern; my $W = $self->whitespace_pattern; $iPrice =~ s!($currency)$W*($currency)!$1 (Buy-It-Now for $2)!; if ($iPrice =~ s/FREE\s+SHIPPING//i) { $hit->shipping('free'); } # if $hit->bid_amount($iPrice); return 1; } # _parse_price sub _parse_bids { my $self = shift; my $oTDbids = shift; my $hit = shift; my $iBids = 0; if (ref $oTDbids) { if (my $oChild = $oTDbids->look_down(_tag => 'div', class => 'bids')) { # As of 2013-03, we need to separate out the price and the bid: $oTDbids = $oChild; } # if my $s = $oTDbids->as_HTML; if (DEBUG_COLUMNS || (1 < $self->{_debug})) { print STDERR " DDD TDbids ===$s===\n"; } # if if ($oTDbids->attr('class') !~ m'\b(ebcBid|bids)\b') { # If we see this, we probably were searching for Store items # but we ran off the bottom of the Store item list and ran # into the list of Auction items. return 0; # There is a separate backend for searching Auction items! } # if $iBids = 1 if ($oTDbids->as_text =~ m/SOLD/i); $iBids = $1 if ($oTDbids->as_text =~ m/(\d+)/); my $W = $self->whitespace_pattern; if ( # Bid listed as hyphen means no bids: ($iBids =~ m!\A$W*-$W*\Z!) || # Bid listed as whitespace means no bids: ($iBids =~ m!\A$W*\Z!) ) { $iBids = 0; } # if } # if if ($iBids =~ m/NO/i) { $iBids = 0; } # if $iBids ||= 0; # print STDERR " DDD setting bid_count to =$iBids=\n"; $hit->bid_count($iBids); return 1; } # _parse_bids sub _parse_shipping { my $self = shift; my $oTD = shift; my $hit = shift; if ($oTD->attr('class') =~ m'\bebcCty\b') { # If we see this, we probably were searching for UK auctions # but we ran off the bottom of the UK item list and ran # into the list of international items. return 0; } # if if (my $oChild = $oTD->look_down(_tag => 'span', class => 'ship')) { # As of 2013-03, we need to separate out the price and the # shipping for some flavors of eBay: $oTD = $oChild; } # if my $iPrice = $oTD->as_text; # I don't know why there are sometimes weird characters in there: $iPrice =~ s!Â!!g; $iPrice =~ s!Â!!g; print STDERR " DDD raw shipping ===$iPrice===\n" if (DEBUG_COLUMNS || (1 < $self->{_debug})); return 0 if ($iPrice !~ m/\d/); $iPrice =~ s!£!GBP!; $hit->shipping($iPrice); return 1; } # _parse_shipping sub _parse_skip { my $self = shift; my $oTD = shift; my $hit = shift; return 1; } # _parse_skip sub _parse_enddate { my $self = shift; my $oTDdate = shift; my $hit = shift; my $sDate = 'unknown'; my ($s, $sDateTemp); if (ref $oTDdate) { $sDateTemp = $oTDdate->as_text; $s = $oTDdate->as_HTML; } # if else { $sDateTemp = $s = $oTDdate; } print STDERR " DDD TDdate ===$s===\n" if (DEBUG_COLUMNS || (1 < $self->{_debug})); # New version as of 2013-03: if ($s =~ m/\bTIMEMS="(\d+)"/i) { $sDate = $1; $sDate = $self->_format_date(ParseDate(q{epoch }. int($sDate/1000))); $hit->end_date($sDate); # For backward-compatibility: $hit->change_date($sDate); return 1; } if (ref($oTDdate)) { if ($oTDdate->attr('class') !~ m/\b(col3|ebcTim|ti?me)\b/) { # If we see this, we probably were searching for Buy-It-Now items # but we ran off the bottom of the item list and ran into the list # of Store items. return 0; # There is a separate backend for searching Store items! } # if } # if print STDERR " DDD raw sDateTemp ===$sDateTemp===\n" if (DEBUG_DATES || (1 < $self->{_debug})); if ($sDateTemp =~ m/---/) { # If we see this, we probably were searching for Buy-It-Now items # but we ran off the bottom of the item list and ran into the list # of Store items. return 0; # There is a separate backend for searching Store items! } # if # I don't know why there are sometimes weird characters in there: $sDateTemp =~ s!Â!!g; $sDateTemp =~ s!Â!!g; $sDateTemp =~ s!_process_date_abbrevs($sDateTemp); print STDERR " DDD cooked sDateTemp ===$sDateTemp===\n" if (DEBUG_DATES || (1 < $self->{_debug})); print STDERR " DDD official time =====$self->{_ebay_official_time}=====\n" if (DEBUG_DATES || (1 < $self->{_debug})); my $date = DateCalc($self->{_ebay_official_time}, " + $sDateTemp"); print STDERR " DDD date ===$date===\n" if (DEBUG_DATES || (1 < $self->{_debug})); $sDate = $self->_format_date($date); print STDERR " DDD sDate ===$sDate===\n" if (DEBUG_DATES || (1 < $self->{_debug})); $hit->end_date($sDate); # For backward-compatibility: $hit->change_date($sDate); return 1; } # _parse_enddate =item result_as_HTML Given a WWW::SearchResult object representing an auction, formats it human-readably with HTML. An optional second argument is the date format, a string as specified for Date::Manip::UnixDate. Default is '%Y-%m-%d %H:%M:%S' my $sHTML = $oSearch->result_as_HTML($oSearchResult, '%H:%M %b %E'); =cut sub result_as_HTML { my $self = shift; my $oSR = shift or return ''; my $sDateFormat = shift || q'%Y-%m-%d %H:%M:%S'; my $dateEnd = ParseDate($oSR->end_date); my $iItemNum = $oSR->item_number; my $sSold = $oSR->sold ? $cgi->font({color=>'green'}, 'sold') .q{; } : $cgi->font({color=>'red'}, 'not sold') .q{; }; my $sBids = $self->_bidcount_as_text($oSR); my $sPrice = $self->_bidamount_as_text($oSR); my $sEndedColor = 'green'; my $sEndedWord = 'ends'; my $dateNow = ParseDate('now'); print STDERR " DDD compare end_date ==$dateEnd==\n" if (DEBUG_DATES || (1 < $self->{_debug})); print STDERR " DDD compare date_now ==$dateNow==\n" if (DEBUG_DATES || (1 < $self->{_debug})); if (Date_Cmp($dateEnd, $dateNow) < 0) { $sEndedColor = 'red'; $sEndedWord = 'ended'; } # if my $sEnded = $cgi->font({ color => $sEndedColor }, UnixDate($dateEnd, qq"$sEndedWord $sDateFormat")); my $s = $cgi->b( $cgi->a({href => $oSR->url}, $oSR->title), $cgi->br, qq{$sEnded; $sSold$sBids$sPrice}, ); $s .= $cgi->br; $s .= $cgi->font({size => -1}, $cgi->a({href => qq{http://cgi.ebay.com/ws/eBayISAPI.dll?MakeTrack&item=$iItemNum}}, 'watch this item in MyEbay'), ); # Format the entire thing as Helvetica: $s = $cgi->font({face => 'Arial, Helvetica'}, $s); return $s; } # result_as_HTML =back =head1 METHODS TO BE OVERRIDDEN IN SUBCLASSING You only need to read about these if you are subclassing this module (i.e. making a backend for another flavor of eBay search). =over =cut =item _get_result_count_elements Given an HTML::TreeBuilder object, return a list of HTML::Element objects therein which could possibly contain the approximate result count verbiage. =cut sub _get_result_count_elements { my $self = shift; my $tree = shift; my @ao = $tree->look_down( '_tag' => 'div', class => 'fpcc' ); push @ao, $tree->look_down( '_tag' => 'div', class => 'fpc' ); push @ao, $tree->look_down( # For basic search, as of 2013-03: '_tag' => 'div', class => 'clt' ); push @ao, $tree->look_down( '_tag' => 'div', class => 'count' ); push @ao, $tree->look_down( '_tag' => 'div', class => 'pageCaptionDiv' ); push @ao, $tree->look_down( # for BySellerID as of 2010-07 '_tag' => 'div', id => 'rsc' ); return @ao; } # _get_result_count_elements =item _get_itemtitle_tds Given an HTML::TreeBuilder object, return a list of HTML::Element objects therein representing elements which could possibly contain the HTML for result title and hotlink. =cut sub _get_itemtitle_tds { my $self = shift; my $tree = shift; my @ao = $tree->look_down(_tag => 'td', class => 'details', ); push @ao, $tree->look_down(_tag => 'td', class => 'ebcTtl', ); push @ao, $tree->look_down(_tag => 'td', class => 'dtl', # This is for eBay auctions as of 2010-07 ); # This is for BuyItNow (thanks to Brian Wilson): push @ao, $tree->look_down(_tag => 'td', class => 'details ttl', ); my $oDiv = $tree->look_down(_tag => 'div', id => 'ResultSetItems', ); if (ref $oDiv) { push @ao, $oDiv->look_down(_tag => 'td', class => 'dtl dtlsp', ); } # if return @ao; } # _get_itemtitle_tds sub _parse_tree { my $self = shift; my $tree = shift; print STDERR " FFF Ebay::_parse_tree\n" if (1 < $self->{_debug}); my $sTitle = $self->{response}->header('title') || ''; my $qrTitle = $self->_title_pattern; # print STDERR " DDD trying to match ==$sTitle== against ==$qrTitle==\n"; if ($sTitle =~ m!$qrTitle!) { my ($sTitle, $iItem, $sDateRaw) = ($1, $2, $3); my $sDateCooked = $self->_format_date($sDateRaw); my $hit = new WWW::Search::Result; $hit->item_number($iItem); $hit->end_date($sDateCooked); # For backward-compatibility: $hit->change_date($sDateCooked); $hit->title($sTitle); $hit->add_url($self->{response}->request->uri); $hit->description($self->_create_description($hit)); # print Dumper($hit); push(@{$self->{cache}}, $hit); $self->{'_num_hits'}++; $self->approximate_result_count(1); return 1; } # if my $iHits = 0; # First, see if: there were zero results and eBay automatically did # a spell-check and searched for other words (or searched for a # subset of query terms): my $oDIV = $tree->look_down( _tag => 'div', class => 'messages', ); if (ref $oDIV) { my $sText = $oDIV->as_text; if ( ($sText =~ m/0 results found for /) && ( ($sText =~ m/ so we searched for /) || ($sText =~ m/ so we removed keywords /) ) ) { $self->approximate_result_count(0); return 0; } # if } # if # See if our query was completely replaced by a similar-spelling query: my $oLI = $tree->look_down(_tag => 'li', class => 'ebInf', ); if (ref $oLI) { if ($oLI->as_text =~ m! keyword has been replaced !) { $self->approximate_result_count(0); return 0; } # if } # if # The hit count is in a FONT tag: my @aoFONT = $self->_get_result_count_elements($tree); FONT: foreach my $oFONT (@aoFONT) { my $qr = $self->_result_count_pattern; print STDERR (" DDD result_count try ==", $oFONT->as_text, "== against qr=$qr=\n") if (1 < $self->{_debug}); if ($oFONT->as_text =~ m!$qr!) { my $sCount = $1; print STDERR " DDD matched ($sCount)\n" if (1 < $self->{_debug}); # Make sure it's an integer: $sCount =~ s!,!!g; $self->approximate_result_count($sCount); last FONT; } # if } # foreach # Recursively parse the stats telling how many items were found in # each category: my $oUL = $tree->look_down(_tag => 'ul', class => 'categories'); $self->{categories} ||= []; $self->_parse_category_list($oUL, $self->{categories}) if ref($oUL); # First, delete all the results that came from spelling variations: my $oDiv = $tree->look_down(_tag => 'div', id => 'expSplChk', ); if (ref $oDiv) { # print STDERR " DDD found a spell-check ===", $oDiv->as_text, "===\n"; $oDiv->detach; $oDiv->delete; } # if # By default, use the hard-coded order of columns: my @asColumns = $self->_columns; if (ref($self) !~ m!::Completed!) { # See if we can glean the actual order of columns from the page itself: my @aoCOL = $tree->look_down(_tag => 'col'); my @asId; foreach my $oCOL (@aoCOL) { # Sanity check: next unless ref($oCOL); my $sId = $oCOL->attr('id') || ''; # Sanity check: next unless ($sId ne ''); $sId =~ s!\Aebc!!; # Try not to go past the first table: last if ($sId eq 'bdrRt'); push @asId, $sId; } # foreach print STDERR " DDD raw asId is (@asId)\n" if (1 < $self->{_debug}); 1 while (@asId && (shift(@asId) ne 'title')); local $" = ','; print STDERR " DDD cooked asId is (@asId)\n" if (1 < $self->{_debug}); @asColumns = @asId if @asId; } # if print STDERR " DDD asColumns is (@asColumns)\n" if (1 < $self->{_debug}); # The list of matching items is in a table. The first column of the # table is nothing but icons; the second column is the good stuff. my @aoTD = $self->_get_itemtitle_tds($tree); unless (@aoTD) { print STDERR " EEE did not find table of results\n" if $self->{_debug}; # use File::Slurp; # write_file('no-results.html', $self->{response}->content); } # unless my $qrItemNum = qr{(\d{11,13})}; TD: foreach my $oTDtitle (@aoTD) { # Sanity check: next TD unless ref $oTDtitle; my $sTDtitle = $oTDtitle->as_HTML; print STDERR " DDD try TDtitle ===$sTDtitle===\n" if (1 < $self->{_debug}); # First A tag contains the url & title: my $oA = $oTDtitle->look_down('_tag', 'a'); next TD unless ref $oA; # This is needed for Ebay::UK to make sure we're looking at the right TD: my $sTitle = $oA->as_text || ''; next TD if ($sTitle eq ''); print STDERR " DDD sTitle ===$sTitle===\n" if (1 < $self->{_debug}); my $oURI = URI->new($oA->attr('href')); # next TD unless ($oURI =~ m!ViewItem!); next TD if ($oURI !~ m!$qrItemNum!); my $iItemNum = $1; my $iCategory = -1; $iCategory = $1 if ($oURI =~ m!QQcategoryZ(\d+)QQ!); print STDERR " DDD iItemNum ===$iItemNum===\n" if (1 < $self->{_debug}); if ($oURI->as_string =~ m!QQitemZ(\d+)QQ!) { # Convert new eBay links to old reliable ones: # $oURI->path(''); $oURI->path('/ws/eBayISAPI.dll'); $oURI->query("ViewItem&item=$1"); } # if my $sURL = $oURI->as_string; my $hit = new WWW::Search::Result; $hit->add_url($self->_cleanup_url($sURL)); $hit->title($sTitle); $hit->category($iCategory); $hit->item_number($iItemNum); # This is just to prevent undef warnings later on: $hit->bid_count(0); # The rest of the info about this item is in sister TD elements to # the right: my @aoSibs = $oTDtitle->right; # But in the Completed auctions list, the rest of the info is in # the next row of the table: if (0 && ref($self) =~ m!::Completed!) { @aoSibs = (); my $oTRparent = $oTDtitle->look_up(_tag => 'tr'); if (ref $oTRparent) { my $sTRparent = $oTRparent->as_HTML; # print STDERR " DDD oTRparent ==$sTRparent==\n"; my $oTRaunt = $oTRparent->right; if (ref $oTRaunt) { my $sTRaunt = $oTRaunt->as_HTML; # print STDERR " DDD oTRaunt ==$sTRaunt==\n"; @aoSibs = $oTRaunt->look_down(_tag => 'td'); # Throw out one empty cell: shift @aoSibs; } # if } # if } # if my $iCol = 0; my $oTDprev; warn " DDD before loop, there are ", scalar(@aoSibs), " sibling TDs\n" if (1 < $self->{_debug}); SIBLING_TD: while (my $sColumn = $asColumns[$iCol++]) { warn " DDD just inside loop, there are ", scalar(@aoSibs), " sibling TDs\n" if (1 < $self->{_debug}); if ($sColumn =~ m/(repeat|stay|same)/i) { # Re-use the previous table cell for the (next) column of data: unshift @aoSibs, $oTDprev; warn " DDD after unshifting, there are ", scalar(@aoSibs), " sibling TDs\n" if (1 < $self->{_debug}); next SIBLING_TD; } # if my $oTDsib = shift(@aoSibs); next unless ref($oTDsib); my $s = $oTDsib->as_HTML; print STDERR " DDD try TD'$sColumn' ===$s===\n" if (DEBUG_COLUMNS || (1 < $self->{_debug})); if ($sColumn =~ m'price') { next TD unless $self->_parse_price($oTDsib, $hit); } # if elsif ($sColumn =~ m'bids') { # It is not a fatal error if there are no bids (i.e. buy-it-now) $self->_parse_bids($oTDsib, $hit); } elsif ($sColumn eq 'shipping') { next TD unless $self->_parse_shipping($oTDsib, $hit); } elsif ($sColumn eq 'enddate') { next TD unless $self->_parse_enddate($oTDsib, $hit); } elsif ($sColumn eq 'time') { next TD unless $self->_parse_enddate($oTDsib, $hit); } elsif ($sColumn eq 'country') { # This listing is from a country other than the base site # we're searching against. Throw it out: next TD; } elsif ($sColumn eq 'paypal') { # We always ignore the Paypal logo. next SIBLING_TD; } elsif ($sColumn eq 'buyitnowlogo') { # We always ignore the Buy-It-Now logo. next SIBLING_TD; } else { # print STDERR " DDD do not know how to handle column named $sColumn\n" if (1 < $self->{_debug}); next SIBLING_TD; } $oTDprev = $oTDsib; } # while my $sDesc = $self->_create_description($hit); $hit->description($sDesc); # Clean up / sanity check hit info: my ($enddate, $iBids); if ( defined($enddate = $hit->end_date) && defined($iBids = $hit->bid_count) && (0 < $iBids) # Item got any bids && (Date_Cmp($enddate, 'now') < 0) # Item is ended ) { # Item must have been sold!?! $hit->sold(1); } # if print STDERR " DDD add hit to cache\n" if (1 < $self->{_debug}); push(@{$self->{cache}}, $hit); $self->{'_num_hits'}++; $iHits++; # Delete this HTML element so that future searches go faster? $oTDtitle->detach; $oTDtitle->delete; } # foreach TD undef $self->{_next_url}; if (0) { # AS OF 2008-11 THE NEXT LINK CAN NOT BE FOLLOWED FROM PERL CODE # Look for a NEXT link: my @aoA = $tree->look_down('_tag', 'a'); TRY_NEXT: foreach my $oA (0, reverse @aoA) { next TRY_NEXT unless ref $oA; print STDERR " DDD try NEXT A ===", $oA->as_HTML, "===\n" if (1 < $self->{_debug}); my $href = $oA->attr('href'); next TRY_NEXT unless $href; # Looking backwards from the bottom of the page, if we get all the # way to the item list, there must be no next button: last TRY_NEXT if ($href =~ m!ViewItem!); if ($oA->as_text eq $self->_next_text) { print STDERR " DDD got NEXT A ===", $oA->as_HTML, "===\n" if 1 < $self->{_debug}; my $sClass = $oA->attr('class') || ''; if ($sClass =~ m/disabled/i) { last TRY_NEXT; } # if $self->{_next_url} = $self->absurl($self->{_prev_url}, $href); last TRY_NEXT; } # if } # foreach } # if 0 # All done with this page. $tree->delete; return $iHits; } # _parse_tree =item _parse_category_list Parses the Category list from the left side of the results page. So far, this method can handle every type of eBay search currently implemented. If you find that it doesn't suit your needs, please contact the author because it's probably just a tiny tweak that's needed. =cut sub _parse_category_list { my $self = shift; my $oTree = shift; my $ra = shift; my $oUL = $oTree->look_down(_tag => 'ul'); my @aoLI = $oUL->look_down(_tag => 'li'); CATLIST_LI: foreach my $oLI (@aoLI) { my %hash; next CATLIST_LI unless ref($oLI); if ($oLI->parent->same_as($oUL)) { my $oA = $oLI->look_down(_tag => 'a'); next CATLIST_LI unless ref($oA); my $oSPAN = $oLI->look_down(_tag => 'span'); next CATLIST_LI unless ref($oSPAN); $hash{'Name'} = $oA->as_text; $hash{'ID'} = $oA->{'href'}; $hash{'ID'} =~ /sacatZ([0-9]+)/; $hash{'ID'} = $1; my $i = $oSPAN->as_text; $i =~ tr/0-9//cd; $hash{'Count'} = $i; push @{$ra}, \%hash; } # if my @aoUL = $oLI->look_down(_tag => 'ul'); CATLIST_UL: foreach my $oUL (@aoUL) { next CATLIST_UL unless ref($oUL); if($oUL->parent()->same_as($oLI)) { $hash{'Subcategory'} = (); $self->_parse_category_list($oLI, \@{$hash{'Subcategory'}}); } # if } # foreach CATLIST_UL } # foreach CATLIST_LI } # _parse_category_list =item _process_date_abbrevs Given a date string, converts common abbreviations to their full words (so that the string can be unambiguously parsed by Date::Manip). For example, in the default English, 'd' becomes 'days'. =cut sub _process_date_abbrevs { my $self = shift; my $s = shift; $s =~ s!d! days!; $s =~ s!h! hours!; $s =~ s!m! minutes!; return $s; } # _process_date_abbrevs =item _next_text The text of the "Next" button, localized for a specific type of eBay backend. =cut sub _next_text { return 'Next'; } # _next_text =item whitespace_pattern Return a qr// pattern to match whitespace your webpage's language. =cut sub whitespace_pattern { # A pattern to match HTML whitespace: return qr{[\ \t\r\n\240]}; } # whitespace_pattern =item _currency_pattern Return a qr// pattern to match mentions of money in your webpage's language. Include the digits in the pattern. =cut sub _currency_pattern { my $self = shift; # A pattern to match all possible currencies found in USA eBay # listings: my $W = $self->whitespace_pattern; return qr/(?:\$|C|EUR|GBP)$W*[0-9.,]+/; } # _currency_pattern =item _title_pattern Return a qr// pattern to match the webpage title in your webpage's language. Add grouping parenthesis so that $1 becomes the auction title, $2 becomes the eBay item number, and $3 becomes the end date. =cut sub _title_pattern { return qr{\A(.+?)\s+-\s+EBAY\s+\(ITEM\s+(\d+)\s+END\s+TIME\s+([^)]+)\)\Z}i; # } # _title_pattern =item _result_count_pattern Return a qr// pattern to match the result count in your webpage's language. Include parentheses so that $1 becomes the number (with commas is OK). =cut sub _result_count_pattern { return qr'([0-9,]+)\s+(active\s+)?(listing|item|matche?|result)s?(\s+found)?\b'; } # _result_count_pattern =item _columns Specify the order in which data columns appear in the search results table. =cut sub _columns { my $self = shift; # This is for basic USA eBay: return qw( enddate price repeat bids ); } # _columns 1; __END__ =back =head1 SEE ALSO To make new back-ends, see L. =head1 BUGS Please tell the author if you find any! =head1 AUTHOR Martin 'Kingpin' Thurn, C, L. Some fixes along the way contributed by Troy Davis. =head1 LEGALESE THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. =head1 LICENSE Copyright (C) 1998-2009 Martin 'Kingpin' Thurn This software is released under the same license as Perl itself. =cut WWW-Search-Ebay-3.031/lib/WWW/Search/Ebay/0000755000175000017500000000000012207530063017150 5ustar martinmartinWWW-Search-Ebay-3.031/lib/WWW/Search/Ebay/Auctions.pm0000644000175000017500000000111411364703305021274 0ustar martinmartin # $Id: Auctions.pm,v 1.9 2010/04/25 00:03:17 Martin Exp $ =head1 NAME WWW::Search::Ebay::Auctions - backend for searching auctions at www.ebay.com =head1 DESCRIPTION This module is just a synonym of WWW::Search::Ebay. =head1 AUTHOR Martin 'Kingpin' Thurn, C, L. =head1 LICENSE Copyright (C) 1998-2009 Martin 'Kingpin' Thurn =cut package WWW::Search::Ebay::Auctions; use strict; use warnings; use base 'WWW::Search::Ebay'; our $VERSION = do { my @r = (q$Revision: 1.9 $ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r }; 1; __END__ WWW-Search-Ebay-3.031/lib/WWW/Search/Ebay/ByEndDate.pm0000644000175000017500000001336711364703325021325 0ustar martinmartin# Ebay/ByEndDate.pm # by Martin Thurn # $Id: ByEndDate.pm,v 2.32 2010/04/25 00:03:33 Martin Exp $ =head1 NAME WWW::Search::Ebay::ByEndDate - backend for searching www.ebay.com, with results sorted with "items ending first" =head1 SYNOPSIS use WWW::Search; my $oSearch = new WWW::Search('Ebay::ByEndDate'); my $sQuery = WWW::Search::escape_query("C-10 carded Yakface"); $oSearch->native_query($sQuery); while (my $oResult = $oSearch->next_result()) { print $oResult->url, "\n"; } =head1 DESCRIPTION This class is a Ebay specialization of WWW::Search. It handles making and interpreting Ebay searches F. This class exports no public interface; all interaction should be done through L objects. =head1 NOTES The calling program must ensure that the Date::Manip module is able to determine the local timezone. The easiest way is to set the environment variable TZ, or by calling &Date_Init(). See the documentation of Date::Manip. The search is done against CURRENT running auctions only. The query is applied to TITLES only. The results are ordered auctions ending soon first (order of increasing auction ending date). In the resulting WWW::Search::Result objects, the description field consists of a human-readable combination (joined with semicolon-space) of the Item Number; number of bids; and high bid amount (or starting bid amount). In the WWW::Search::Result objects, the change_date field contains the auction ending date & time in ISO 8601 format; i.e. year-month-dayThour:minute:second. =head1 SEE ALSO To make new back-ends, see L. =head1 CAVEATS =head1 BUGS Please tell the author if you find any! =head1 AUTHOR Martin 'Kingpin' Thurn, C, L. =head1 LEGALESE Copyright (C) 1998-2009 Martin 'Kingpin' Thurn THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. =cut ##################################################################### package WWW::Search::Ebay::ByEndDate; use strict; use warnings; use Carp; use Data::Dumper; use Date::Manip; use base 'WWW::Search::Ebay'; our $VERSION = do { my @r = (q$Revision: 2.32 $ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r }; our $MAINTAINER = 'Martin Thurn '; # Damn it's hard to get a timezone: my ($n, $isdst); ($n, $n, $n, $n, $n, $n, $n, $n, $isdst) = localtime(time); my $EBAY_TZ = 'PST'; substr($EBAY_TZ, 1, 1) = 'D' if $isdst; # private sub _native_setup_search { my ($self, $native_query, $rhOptsArg) = @_; $rhOptsArg ||= {}; unless (ref($rhOptsArg) eq 'HASH') { carp " --- second argument to _native_setup_search should be hashref, not arrayref"; return undef; } # unless $rhOptsArg->{'SortProperty'} = 'MetaEndSort'; # my @a = sort &Date_Init(); # print STDERR " III BEFORE: ", Dumper(\@a); &Date_Init("ConvTZ=$EBAY_TZ"); # @a = sort &Date_Init(); # print STDERR " III AFTER: ", Dumper(\@a); # We need to know the time in eBayLand right now: my $dateToday = &ParseDate('today'); my $tz = $Date::Manip::Cnf{TZ}; # &UnixDate('today', '%Z'); # print STDERR " today ==$dateToday==\n"; # print STDERR " from tz ==$tz==\n"; # print STDERR " to tz ==$EBAY_TZ==\n"; $self->{_today_} = &Date_ConvTZ($dateToday, $tz, $EBAY_TZ); # print STDERR " today == ", $self->{_today_}, "\n"; # exit; return $self->SUPER::_native_setup_search($native_query, $rhOptsArg); } # _native_setup_search # Enforce sorting by end date, even if Ebay is returning it in a # different order. (They will be out of order if there are "Featured # Items" at the top of the page.) Calls _parse_tree() of the base # class, and then reshuffles its 'cache' results. Code contributed by # Mike Schilli. sub _parse_tree { my ($self, @args) = @_; my $hits = $self->SUPER::_parse_tree(@args); $self->{cache} ||= []; if (0) { # Convert all eBay relative times to absolute times: $self->{cache} = [ map { my $iMin = _minutes($_->change_date) || _minutes(_date_to_rel($_->change_date, $self->{_today_})); $_->change_date(&UnixDate(&DateCalc($self->{_today_}, " + $iMin minutes"), '%Y-%m-%dT%H:%M:%S')); $_ } grep { ref } @{$self->{cache}} ]; } # if # Sort by date using a Schwartzian transform to save memory: $self->{cache} = [ map { $_->[0] } sort { $a->[1] cmp $b->[1] } map { [ $_, $_->change_date ] } @{$self->{cache}} ]; return $hits; } # _parse_tree use constant DEBUG_MINUTES => 0; sub _minutes { my $s = shift; DEBUG_MINUTES && print STDERR " III _minutes($s)...\n"; my $min = 0; $min += 60*24*$1 if $s =~ /(\d+)\s?[dT]/; $min += 60*$1 if $s =~ /(\d+)\s?[hS]/; $min += $1 if $s =~ /(\d+)\s?[mM]/; DEBUG_MINUTES && print STDERR " min=$min=\n"; return $min; } # _minutes sub _date_to_rel { my $string = shift; my $today = shift; DEBUG_MINUTES && print STDERR " III _date_to_rel($string)...\n"; my $date = ParseDate($string) || ''; DEBUG_MINUTES && print STDERR " raw date =$date=...\n"; my $delta = DateCalc($today, $date) || 0; DEBUG_MINUTES && print STDERR " delta =$delta=...\n"; # Convert to minutes: my $iMin = int(&Delta_Format($delta, 0, '%mt')); my $result = "$iMin min"; DEBUG_MINUTES && print STDERR " result =$result=...\n"; return $result; } # _date_to_rel 1; __END__ WWW-Search-Ebay-3.031/lib/WWW/Search/Ebay/BuyItNow.pm0000644000175000017500000000415412161637363021244 0ustar martinmartin # $Id: BuyItNow.pm,v 1.16 2013/06/23 18:31:15 martin Exp $ =head1 NAME WWW::Search::Ebay::BuyItNow - backend for searching eBay Buy-It-Now items =head1 SYNOPSIS use WWW::Search; my $oSearch = new WWW::Search('Ebay::BuyItNow'); my $sQuery = WWW::Search::escape_query("jawa"); $oSearch->native_query($sQuery); while (my $oResult = $oSearch->next_result()) { print $oResult->url, "\n"; } =head1 DESCRIPTION This class is a Ebay specialization of WWW::Search. It handles making and interpreting Ebay searches F. This class exports no public interface; all interaction should be done through L objects. =head1 NOTES The search is done against eBay Buy-It-Now items only. The query is applied to TITLES only. In the resulting WWW::Search::Result objects, the description field consists of a human-readable combination (joined with semicolon-space) of the Item Number; number of bids; and high bid amount (or starting bid amount). =head1 SEE ALSO To make new back-ends, see L. =head1 BUGS Please tell the author if you find any! =head1 AUTHOR Martin 'Kingpin' Thurn, C, L. =head1 LICENSE Copyright (C) 1998-2009 Martin 'Kingpin' Thurn =cut package WWW::Search::Ebay::BuyItNow; use strict; use warnings; use WWW::Search::Ebay; use base 'WWW::Search::Ebay'; our $VERSION = do { my @r = (q$Revision: 1.16 $ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r }; sub _native_setup_search { my ($self, $sQuery, $rh) = @_; # http://shop.ebay.com/items/_W0QQLHQ5fBINZ1QQLHQ5fIncludeSIFZ1?_nkw=Burkina+Faso+flag&_sacat=0&_fromfsb=&_trksid=m270.l1313&_odkw=Burkina+Faso&_osacat=0 # http://shop.ebay.com/items/_W0QQLHQ5fBINZ1QQLHQ5fIncludeSIFZ1?_nkw=Burkina+Faso+flag $self->{search_host} = q{http://shop.ebay.com}; $self->{search_path} = q{/items/_W0QQLHQ5fBINZ1}; $self->{'_options'} = { '_nkw' => $sQuery, }; return $self->SUPER::_native_setup_search($sQuery, $rh); } # _native_setup_search sub _columns { my $self = shift; return qw( price ); } # _columns 1; __END__ WWW-Search-Ebay-3.031/lib/WWW/Search/Ebay/BySellerID.pm0000644000175000017500000000544712161735612021464 0ustar martinmartin # $Id: BySellerID.pm,v 2.13 2013/06/24 03:22:50 martin Exp $ =head1 NAME WWW::Search::Ebay::BySellerID - backend for searching eBay for items offered by a particular seller =head1 SYNOPSIS use WWW::Search; my $oSearch = new WWW::Search('Ebay::BySellerID'); my $sQuery = WWW::Search::escape_query("martinthurn"); $oSearch->native_query($sQuery); while (my $oResult = $oSearch->next_result()) { print $oResult->url, "\n"; } =head1 DESCRIPTION See L for details. The query string must be an eBay seller ID. This class is an Ebay specialization of WWW::Search. It handles making and interpreting Ebay searches F. This class exports no public interface; all interaction should be done through L objects. =head1 NOTES Searches only for items offered by eBay sellers whose ID matches exactly. See L for explanation of the results. =head1 SEE ALSO To make new back-ends, see L. =head1 BUGS Please tell the author if you find any! =head1 AUTHOR Martin 'Kingpin' Thurn, C, L. =head1 LICENSE Copyright (C) 1998-2009 Martin 'Kingpin' Thurn =cut package WWW::Search::Ebay::BySellerID; use strict; use warnings; use base 'WWW::Search::Ebay'; our $VERSION = do { my @r = (q$Revision: 2.13 $ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r }; sub _native_setup_search { my ($self, $sQuery, $rh) = @_; # As of 2013-03: # http://www.ebay.com/sch/allhypedup82/m.html?_ipg=200&_sop=1&_rdc=1 $rh->{search_host} = 'http://www.ebay.com'; $rh->{search_path} = qq'/sch/$sQuery/m.html'; $self->{_options} = { _ipg => $self->{_hits_per_page}, _rdc => 1, _sop => 1, }; return $self->SUPER::_native_setup_search($sQuery, $rh); # Old version: $rh->{'MfcISAPICommand'} = 'MemberSearchResult'; $rh->{'frompage'} = 'itemsbyseller'; $rh->{'sofindtype'} = '26'; $rh->{'userid'} = $sQuery; # $rh->{'completed'} = 1; # Also return completed auctions # $rh->{'since'} = 30; # The oldest possible # $rh->{'include'} = 1; # also return bidders email addresses (only # possible if you login) $rh->{'fcm'} = 0; # Whether to return "similar" user ids $rh->{'frpp'} = '200'; # Results per page $rh->{'submit'} = 'Search'; # Don't know what the rest are for: $rh->{'fcl'} = '3'; $rh->{'amp;sspagename'} = 'h:h:advsearch:US'; $rh->{'sacat'} = '-1'; $rh->{'nojspr'} = 'y'; $rh->{'catref'} = 'C5'; $rh->{'from'} = 'R7'; $rh->{'pfid'} = '0'; return $self->SUPER::_native_setup_search('', $rh); } # _native_setup_search sub _columns { my $self = shift; # This is for basic USA eBay: return qw( enddate price repeat bids ); } # _columns 1; __END__ WWW-Search-Ebay-3.031/lib/WWW/Search/Ebay/Motors.pm0000644000175000017500000000523112161734340020775 0ustar martinmartin # $Id: Motors.pm,v 1.18 2013/06/24 03:11:28 martin Exp $ =head1 NAME WWW::Search::Ebay::Motors - backend for searching eBay Motors =head1 SYNOPSIS use WWW::Search; my $oSearch = new WWW::Search('Ebay::Motors'); my $sQuery = WWW::Search::escape_query("Buick Star Wars"); $oSearch->native_query($sQuery); while (my $oResult = $oSearch->next_result()) { print $oResult->url, "\n"; } =head1 DESCRIPTION This class is a Ebay Motors specialization of WWW::Search. It handles making and interpreting Ebay searches F. This class exports no public interface; all interaction should be done through L objects. =head1 NOTES Same as L. =head1 OPTIONS Same as L. =head1 SEE ALSO To make new back-ends, see L. =head1 CAVEATS =head1 BUGS Please tell the author if you find any! =head1 AUTHOR Martin 'Kingpin' Thurn, C, L. =head1 LEGALESE Copyright (C) 1998-2009 Martin 'Kingpin' Thurn THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. =cut ##################################################################### package WWW::Search::Ebay::Motors; use strict; use warnings; use Carp; use Data::Dumper; use base 'WWW::Search::Ebay'; our $VERSION = do { my @r = (q$Revision: 1.18 $ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r }; our $MAINTAINER = 'Martin Thurn '; sub _native_setup_search { my ($self, $native_query, $rhOptsArg) = @_; $rhOptsArg ||= {}; if (ref($rhOptsArg) ne 'HASH') { carp " --- second argument to _native_setup_search should be hashref"; return; } # unless # As of 2013-03: # http://motors.shop.ebay.com/eBay-Motors-/6000/i.html?_nkw=bugatti&_trksid=p2050890.m570.l1313&_rdc=1 $rhOptsArg->{search_host} = 'http://motors.shop.ebay.com'; $rhOptsArg->{search_path} = '/eBay-Motors-/6000/i.html'; $self->{_options} = { _nkw => $native_query, _armrs => 1, # _trksid => 'p2050890.m570.l1313', # Turn off JavaScript: _jsoff => 1, # Search AUCTIONS ONLY: LH_Auction => 1, _ipg => $self->{_hits_per_page}, _rdc => 1, }; return $self->SUPER::_native_setup_search($native_query, $rhOptsArg); } # _native_setup_search sub _columns { my $self = shift; return qw( enddate price repeat bids ); } # _columns 1; __END__ WWW-Search-Ebay-3.031/lib/WWW/Search/Ebay/Category.pm0000644000175000017500000000551111177045151021271 0ustar martinmartin # $Id: Category.pm,v 2.4 2009/05/02 13:28:09 Martin Exp $ =head1 NAME WWW::Search::Ebay::Category - backend for returning entire categories on www.ebay.com =head1 SYNOPSIS use WWW::Search; my $oSearch = new WWW::Search('Ebay::Category'); # Category 1381 is Disney Modern Premiums: $oSearch->native_query(1381); while (my $oResult = $oSearch->next_result()) { print $oResult->url, "\n"; } =head1 DESCRIPTION This class is a Ebay specialization of L. It handles making and interpreting Ebay searches F. This class exports no public interface; all interaction should be done through L objects. =head1 NOTES Returns the "first" 200 *auction* items in the given category. I'm not sure what exactly "first" means in this case; YMMV. It is up to you to determine the number of the category you want. See the NOTES section of L for a description of the results. =head1 METHODS =cut ##################################################################### package WWW::Search::Ebay::Category; use strict; use warnings; use Carp; use Date::Manip; use base 'WWW::Search::Ebay'; our $VERSION = do { my @r = (q$Revision: 2.4 $ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r }; our $MAINTAINER = 'Martin Thurn '; use constant DEBUG_FUNC => 0; sub _native_setup_search { my ($self, $native_query, $rhOptsArg) = @_; $rhOptsArg ||= {}; unless (ref($rhOptsArg) eq 'HASH') { carp " --- second argument to _native_setup_search should be hashref, not arrayref"; return undef; } # unless # As of Jan. 2009: # http://collectibles.shop.ebay.com/items/__W0QQLHQ5fAuctionZ1?_sacat=35845 $self->{'search_host'} = 'http://collectibles.shop.ebay.com'; $self->{search_path} = q{/items/__W0QQLHQ5fAuctionZ1}; $self->{_options} = { _ipg => 200, _sacat => $native_query, }; return $self->SUPER::_native_setup_search($native_query, $rhOptsArg); } # _native_setup_search sub _preprocess_results_page_OFF { my $self = shift; my $sPage = shift; # For debugging: print STDERR $sPage; exit 88; } # preprocess_results_page sub _columns_use_SUPER { my $self = shift; # This is for basic USA eBay: return qw( paypal bids price shipping enddate ); } # _columns 1; =head1 SEE ALSO To make new back-ends, see L. =head1 CAVEATS =head1 BUGS Please tell the author if you find any! =head1 AUTHOR Maintained by Martin Thurn, C, L. =head1 LEGALESE Copyright (C) 1998-2009 Martin 'Kingpin' Thurn THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. =cut __END__ WWW-Search-Ebay-3.031/lib/WWW/Search/Ebay/Stores.pm0000644000175000017500000000515411364703350020776 0ustar martinmartin # $Id: Stores.pm,v 1.18 2010/04/25 00:03:52 Martin Exp $ =head1 NAME WWW::Search::Ebay::Stores - backend for searching eBay Stores =head1 SYNOPSIS use WWW::Search; my $oSearch = new WWW::Search('Ebay::Stores'); my $sQuery = WWW::Search::escape_query("C-10 carded Yakface"); $oSearch->native_query($sQuery); while (my $oResult = $oSearch->next_result()) { print $oResult->url, "\n"; } =head1 DESCRIPTION This class is a Ebay specialization of WWW::Search. It handles making and interpreting Ebay searches F. This class exports no public interface; all interaction should be done through L objects. =head1 NOTES The search is done against eBay Stores items only. The query is applied to TITLES only. See L for a description of the search results. =head1 SEE ALSO To make new back-ends, see L. =head1 BUGS Please tell the author if you find any! =head1 AUTHOR Martin 'Kingpin' Thurn, C, L. Some fixes along the way contributed by Troy Davis. =head1 LICENSE Copyright (C) 1998-2009 Martin 'Kingpin' Thurn =cut package WWW::Search::Ebay::Stores; use strict; use warnings; use base 'WWW::Search::Ebay'; our $VERSION = do { my @r = (q$Revision: 1.18 $ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r }; sub _native_setup_search { my ($self, $sQuery, $rh) = @_; # As of 2004-10-20: # http://search.stores.ebay.com/search/search.dll?sofocus=bs&sbrftog=1&catref=C6&socurrencydisplay=1&from=R10&sasaleclass=1&sorecordsperpage=100&sotimedisplay=1&socolumnlayout=2&satitle=star+wars+lego&sacategory=-6%26catref%3DC6&bs=Search&sofp=4&sotr=2&sapricelo=&sapricehi=&searchfilters=&sosortproperty=1&sosortorder=1 # simplest = http://search.stores.ebay.com/search/search.dll?socurrencydisplay=1&sasaleclass=1&sorecordsperpage=100&sotimedisplay=1&socolumnlayout=2&satitle=star+wars+lego # As of 2005-08-29: # http://search.stores.ebay.com/search/search.dll?satitle=093624-69602-5 $rh->{'search_host'} = 'http://search.stores.ebay.com'; $rh->{'search_path'} = '/search/search.dll'; $rh->{'satitle'} = $sQuery; # Turn off default W::S::Ebay options: $self->{_options} = {}; return $self->SUPER::_native_setup_search($sQuery, $rh); } # _native_setup_search sub _preprocess_results_page_OFF { my $self = shift; my $sPage = shift; # print STDERR Dumper($self->{response}); # For debugging: print STDERR $sPage; exit 88; } # _preprocess_results_page sub _columns_same_as_base_ebay { my $self = shift; # This is for Stores: return qw( paypal bids price enddate ); } # _columns 1; __END__ WWW-Search-Ebay-3.031/Makefile.PL0000644000175000017500000000311312207530035015600 0ustar martinmartin # $rcs = ' $Id: Makefile.PL,v 1.95 2013/08/29 02:21:17 martin Exp $ '; use inc::Module::Install; version(3.031); all_from('lib/WWW/Search/Ebay.pm'); requires(perl => 5.005); test_requires('Bit::Vector'); requires('Date::Manip'); # requires('DateTime::TimeZone'); test_requires('Date::Manip'); requires('HTML::TreeBuilder'); test_requires('IO::Capture::Stderr'); requires('LWP::Simple'); # Test::More is needed for `make test`: test_requires('Test::More'); recommends('Test::Pod'); recommends('Test::Pod::Coverage'); # We need the version that has methods named with leading underscore: requires('WWW::Search' => 2.557); # We need the version that has the bidder and seller methods: requires('WWW::SearchResult' => 2.067); # We need the bug-fixed version of WWW::Search::Test: test_requires('WWW::Search::Test' => 2.290); my $ret = <<'PART0'; coverage : $(RM_RF) cover_db/* $(MAKE) HARNESS_PERL_SWITCHES=-MDevel::Cover test cover PART0 postamble $ret; WriteAll; use Env; if ($ENV{MTHURN_PERL_DEV}) { print "DDD This is author's development environment\n"; my $sFnameMakefile = q{Makefile}; eval "use File::Slurp"; my $s = read_file($sFnameMakefile); if ($s !~ s/(DIRFILESEP\s*=\s*).+$/$1\//m) { print " EEE did not find DIRFILESEP in Makefile\n"; } # if if ($s !~ s/(pm_to_blib\(){{\@ARGV}}/$1 . '{@ARGV}'/e) { print " EEE did not find pm_to_blib@ARGV in Makefile\n"; } # if if ($s !~ s/(from_to\s+=>\s+){{\@ARGV}}/$1 . '{@ARGV}'/e) { print " EEE did not find from_to@ARGV in Makefile\n"; } # if write_file($sFnameMakefile, $s); } # if __END__ WWW-Search-Ebay-3.031/Changes0000644000175000017500000003156312207527015015137 0ustar martinmartin2013-08-20 Kingpin * lib/WWW/Search/Ebay.pm (_parse_bids): make sure bid_count is a number (_parse_tree): initialize bid_count to 0 2013-06-23 Kingpin * lib/WWW/Search/Ebay.pm (_get_itemtitle_tds): fixed for new eBay page layout 2010-08-17 Kingpin * lib/WWW/Search/Ebay.pm (_parse_tree): fixed regex for item number 2010-08-01 Kingpin * lib/WWW/Search/Ebay.pm (_result_count_pattern): fixed regexen for result count, price, date 2010-05-20 Kingpin * lib/WWW/Search/Ebay.pm (_parse_enddate): fixed the time-remaining regex 2009-08-30 Kingpin * lib/WWW/Search/Ebay/BuyItNow.pm (_columns): updated for new eBay output * lib/WWW/Search/Ebay.pm (_parse_enddate): fixed for Buy-It-Now auctions 2009-08-10 Kingpin * lib/WWW/Search/Ebay.pm (_parse_price): fixed for "Free Shipping" in the bid column 2009-08-08 Kingpin * lib/WWW/Search/Ebay/Stores.pm: fixed for new HTML format * lib/WWW/Search/Ebay.pm (_columns): fixed for new HTML format * lib/WWW/Search/Ebay/BySellerID.pm (_columns): fixed for new HTML format 2009-02-22 Kingpin * lib/WWW/Search/Ebay.pm (_parse_tree): fixed undef warning (_get_result_count_elements): added element for ::Category search 2009-01-21 Kingpin * lib/WWW/Search/Ebay/Completed/Category.pm: new module 2009-01-19 Kingpin * lib/WWW/Search/Ebay/Category.pm: new backend 2009-01-18 Kingpin * lib/WWW/Search/Ebay.pm (_parse_tree): mark item as "sold" if ended and bidded (fix for Ebay::Completed) 2008-11-10 Kingpin * lib/WWW/Search/Ebay.pm (_parse_tree): fixed patterns for detecting spell-checked query 2008-11-09 Kingpin * lib/WWW/Search/Ebay.pm (_parse_tree): fixed "infinite" looping of page requests 2008-09-06 Kingpin * lib/WWW/Search/Ebay.pm (_get_result_count_elements): added pattern for new motors layout (_result_count_pattern): match commas in result count! (_parse_tree): delete commas from result_count 2008-08-10 Kingpin * lib/WWW/Search/Ebay/Stores.pm (_columns): fixed for new page layout? 2008-06-28 Kingpin * lib/WWW/Search/Ebay.pm (preprocess_results_page): use our own UserAgent to fetch the official eBay time (not a generic LWP::UserAgent) 2008-04-05 * lib/WWW/Search/Ebay/ES.pm (result_count_pattern): fixed 2008-02-25 * lib/WWW/Search/Ebay.pm (user_agent_delay): new method 2008-02-24 * lib/WWW/Search/Ebay/Motors.pm (result_count_pattern): new methods * lib/WWW/Search/Ebay/FR.pm (title_pattern): new method * lib/WWW/Search/Ebay.pm (title_pattern): new method (result_count_regex): renamed method and made public 2007-12-05 * lib/WWW/Search/Ebay.pm (_result_count_regex): allow one hit to match! * lib/WWW/Search/Ebay/IT.pm (_result_count_regex): fixed pattern 2007-12-02 * lib/WWW/Search/Ebay.pm (parse_tree): ignore auctions from other countries 2007-08-20 * lib/WWW/Search/Ebay.pm: FIXED page title regex 2007-05-20 * lib/WWW/Search/Ebay/ES.pm (_result_count_regex): fixed result-count parsing * lib/WWW/Search/Ebay/DE.pm (_process_date_abbrevs): fixed date parsing 2007-01-29 * lib/WWW/Search/Ebay.pm (result_as_HTML): now takes an optional date format argument 2007-01-26 * lib/WWW/Search/Ebay.pm (result_as_HTML): added end-time to "ended" items 2006-12-24 * lib/WWW/Search/Ebay.pm (result_as_HTML): added "add to myEbay" link 2006-09-03 * lib/WWW/Search/Ebay.pm (whitespace_pattern): new method * lib/WWW/Search/Ebay/ES.pm: new backend * lib/WWW/Search/Ebay/FR.pm: new backend * lib/WWW/Search/Ebay/IT.pm: new backend 2006-08-25 * lib/WWW/Search/Ebay/DE.pm: new backend * lib/WWW/Search/Ebay.pm (_process_date_abbrevs): new method (_result_count_regex): new method (_next_text): new method 2006-06-14 * lib/WWW/Search/Ebay.pm (parse_shipping): replace stub method with actual code! (as suggested by John Baleshiski 8-) 2006-04-22 * lib/WWW/Search/Ebay.pm (_bidamount_as_text): new private method (_bidcount_as_text): new private method (result_as_HTML): new method (parse_price): set sold() on results (as suggested by Nick Lokkju) (_parse_category_list): new private method 2006-04-21 * lib/WWW/Search/Ebay.pm (_bid_as_text): new method (result_as_HTML): new method 2006-03-22 * lib/WWW/Search/Ebay.pm (parse_tree): don't use the Switch module 2006-03-11 * lib/WWW/Search/Ebay.pm (parse_enddate): now can take a string argument 2006-02-18 * lib/WWW/Search/Ebay.pm (parse_tree): enhanced to parse Completed listings 2005-12-27 * lib/WWW/Search/Ebay/ByBidderID.pm: new backend! * lib/WWW/Search/Ebay.pm (parse_tree): use new item_number (et al.) attributes in SearchResult 2005-12-25 * lib/WWW/Search/Ebay.pm (parse_tree): now returns the item's category number 2005-08-29 * lib/WWW/Search/Ebay/Stores.pm (native_setup_search): fixed the CGI options 2005-08-27 * lib/WWW/Search/Ebay.pm (parse_tree): determine order of columns dynamically 2005-08-18 * lib/WWW/Search/Ebay/Stores.pm (columns): damn ebay.com changed the column order again * lib/WWW/Search/Ebay.pm (columns): damn ebay.com changed the column order again (parse_price): watch for running off the end of the Stores list * lib/WWW/Search/Ebay/BuyItNow.pm (columns): damn ebay.com changed the column order again 2005-08-16 * lib/WWW/Search/Ebay.pm: new flexible way of parsing table cells in a backend-specific order! * lib/WWW/Search/Ebay/BuyItNow.pm (columns): new method * lib/WWW/Search/Ebay/Motors.pm (columns): new method * lib/WWW/Search/Ebay/Stores.pm (columns): new method * lib/WWW/Search/Ebay/UK.pm (columns): new method 2005-08-14 * lib/WWW/Search/Ebay/BySellerID.pm: NEW BACKEND * t/bysellerid.t: new tests for the above * lib/WWW/Search/Ebay.pm (parse_tree): do not return results from auto-spell-checked query term * t/basic.t: added tests for the above 2005-08-07 * lib/WWW/Search/Ebay.pm (parse_tree): return URLs as simple old cgi arguments 2005-07-30 * lib/WWW/Search/Ebay/UK.pm (_result_count_td_specs_OLD): use parent class' value for this method * lib/WWW/Search/Ebay.pm (preprocess_results_page): fix title pattern 2005-07-29 * lib/WWW/Search/Ebay.pm (parse_tree): two fixes for new eBay page format 2005-06-11 Kingpin * lib/WWW/Search/Ebay/UK.pm (preprocess_results_page): new method (_title_td_specs): new specs (_result_count_td_specs): new specs * lib/WWW/Search/Ebay/Stores.pm (preprocess_results_page): new method 2005-06-10 Kingpin * lib/WWW/Search/Ebay.pm (parse_tree): added a hack to detect when a Stores search runs off the bottom of the list 2005-05-18 Kingpin * lib/WWW/Search/Ebay.pm (_result_count_td_specs): new method (_title_td_specs): new method (parse_tree): fixed parser for new webpage contents * lib/WWW/Search/Ebay/UK.pm (_result_count_td_specs): new method (_title_td_specs): new method 2005-02-28 Kingpin * lib/WWW/Search/Ebay/UK.pm (currency_pattern): clean up pattern 2005-01-25 Kingpin * lib/WWW/Search/Ebay.pm (parse_tree): call _create_description as a method 2005-01-23 Kingpin * lib/WWW/Search/Ebay.pm (_format_date): now a method, not just a function (_create_description): now a method, not just a function (_cleanup_url): new method 2004-11-29 Kingpin * lib/WWW/Search/Ebay/UK.pm: new file * t/uk.t: new file * lib/WWW/Search/Ebay.pm (native_setup_search): fix column order parsing for Ebay::UK 2004-11-27 Kingpin * lib/WWW/Search/Ebay.pm (_format_date): new function (_create_description): new function (parse_tree): detect redirection to single-auction page 2004-11-24 Kingpin * lib/WWW/Search/Ebay.pm (parse_tree): fetch eBay official time, and fix timezone conversion 2004-11-23 Kingpin * lib/WWW/Search/Ebay.pm (parse_tree): omit seconds from change_date value; do not set TZ if it's already in the environment 2004-11-05 Kingpin * t/motors.t: fix 1-page query 2004-10-25 Kingpin * lib/WWW/Search/Ebay.pm (parse_tree): handle default page format * lib/WWW/Search/Ebay/Stores.pm (native_setup_search): let parent object control the HTML page formatting params 2004-10-21 Kingpin * lib/WWW/Search/Ebay.pm (parse_tree): handle new HTML page format * lib/WWW/Search/Ebay/Stores.pm (native_setup_search): new CGI parameters parsing now handled by parent class 2004-09-25 Kingpin * lib/WWW/Search/Ebay.pm (parse_tree): now sets bid_count and bid_amount in the Result objects * lib/WWW/Search/Ebay/Motors.pm (native_setup_search): new backend! * t/motors.t: new test * lib/WWW/Search/Ebay.pm: added pod for how to search one category 2004-09-16 Kingpin * lib/WWW/Search/Ebay/ByEndDate.pm (date_to_rel): new function; (parse_tree): fix date sort; different date format in change_date; 2004-08-20 Kingpin * lib/WWW/Search/Ebay/BuyItNow.pm: new file * t/buyitnow.t (my_test): new file 2004-07-23 Kingpin * lib/WWW/Search/Ebay.pm (parse_tree): fix for parsing result count 2004-06-05 Kingpin * t/stores.t: new file * lib/WWW/Search/Ebay/Stores.pm: new file * lib/WWW/Search/Ebay.pm (currency_pattern): new function 2004-04-17 Kingpin * lib/WWW/Search/Ebay.pm (native_setup_search): new URL / CGI options (parse_tree): handle new HTML formatting 2004-04-08 Kingpin * lib/WWW/Search/Ebay/ByEndDate.pm (parse_tree): fix undef warning * lib/WWW/Search/Ebay.pm (parse_tree): handle new HTML formatting 2003-12-21 Kingpin * lib/WWW/Search/Ebay/Completed.pm: removed because searching completed auctions now requires registered user login * t/completed.t: removed because searching completed auctions now requires registered user login 2003-12-06 Kingpin * lib/WWW/Search/Ebay/ByEndDate.pm: fixed so that "featured" auctions are put into the properly sorted order 2003-11-13 Kingpin * lib/WWW/Search/Ebay.pm (parse_tree): in change_date, convert nbsp to regular space 2003-10-27 Kingpin * t/enddate.t: beefed-up tests * t/basic.t: separated test files * t/completed.t: beefed-up tests * lib/WWW/Search/Ebay.pm (native_setup_search): let the host and path be NON-generic args (thanks to Mike Schilli) 2003-07-13 Kingpin * lib/WWW/Search/Ebay/Completed.pm: new backend (thanks to Troy Arnold) 2003-02-06 Kingpin * lib/WWW/Search/Ebay.pm (parse_tree): Fixed parsing for slightly-changed ebay.com pages * test.pl: added some tests to actually look at the results 2002-10-22 Kingpin * lib/WWW/Search/Ebay/ByEndDate.pm (native_setup_search): Fixed hash vs. array bug? 2002-10-21 Kingpin * lib/WWW/Search/Ebay.pm (parse_tree): Fixed parsing for Buy-It-Now prices, and foreign currencies 2002-07-24 Kingpin * lib/WWW/Search/Ebay.pm (parse_tree): fix parsing around new images in table 2001-12-20 Kingpin * lib/WWW/Search/Ebay.pm (native_retrieve_some): handle new ebay.com output format (parse_tree): rewrite using this new method 2001-07-30 Kingpin * lib/WWW/Search/Ebay/ByEndDate.pm: new backend! 2001-06-26 Kingpin * VERSION 2.05 RELEASED 2001-06-25 Kingpin * Ebay.pm (native_retrieve_some): tweaks to prevent warnings / parse errors 2001-05-08 Kingpin * VERSION 2.04 RELEASED 2001-05-07 Kingpin * Ebay.pm (native_retrieve_some): updated for new output format 2001-04-21 Kingpin * VERSION 2.03 RELEASED 2001-04-20 Kingpin * Ebay.pm (native_retrieve_some): result->description now contains bid info 2001-04-14 Kingpin * VERSION 2.02 RELEASED 2001-04-13 Kingpin * Ebay.pm (native_setup_search): make the user_agent non-robot 2001-04-02 Kingpin * VERSION 2.01 RELEASED Revision history for Perl extension WWW::Search::Ebay WWW-Search-Ebay-3.031/t/0000755000175000017500000000000012207530063014074 5ustar martinmartinWWW-Search-Ebay-3.031/t/stores.t0000644000175000017500000000462512161735743015622 0ustar martinmartin # $Id: stores.t,v 1.20 2013/06/24 03:24:19 martin Exp $ use blib; use Bit::Vector; use Data::Dumper; use Test::More no_plan; use Date::Manip; Date_Init('TZ=-0500'); use WWW::Search; use WWW::Search::Test; BEGIN { use_ok('WWW::Search::Ebay::Stores'); } my $iDebug = 0; my $iDump = 0; tm_new_engine('Ebay::Stores'); # goto DEBUG_NOW; # goto CONTENTS; diag("Sending 0-page stores query..."); $iDebug = 0; # This test returns no results (but we should not get an HTTP error): tm_run_test('normal', $WWW::Search::Test::bogus_query, 0, 0, $iDebug); # DEBUG_NOW: pass; MULTI_RESULT: { $TODO = 'WWW::Search::Ebay can not fetch multiple pages'; diag("Sending multi-page stores query..."); $iDebug = 0; $iDump = 0; # This query returns hundreds of pages of results: tm_run_test('normal', 'LEGO', 101, undef, $iDebug); cmp_ok(1, '<', $WWW::Search::Test::oSearch->{requests_made}, 'got multiple pages'); $TODO = q{}; } pass; DEBUG_NOW: pass; TODO: { $TODO = 'sometimes there are none of this item listed'; diag("Sending 1-page stores query for 12-digit UPC..."); $iDebug = 0; $iDump = 0; tm_run_test('normal', '093624-69602-5', 1, 99, $iDebug, $iDump); $TODO = ''; } TODO: { $TODO = 'sometimes there are none of this item listed'; diag("Sending 1-page stores query for 13-digit EAN..."); $iDebug = 0; $iDump = 0; tm_run_test('normal', '00-77778-60672-7' , 1, 99, $iDebug, $iDump); $TODO = ''; } TODO: { $TODO = 'sometimes there are none of this item listed'; diag("Sending stores query for 10-digit ISBN..."); $iDebug = 0; $iDump = 0; tm_run_test('normal', '0-553-09606-0' , 1, undef, $iDebug, $iDump); $TODO = ''; } # goto SKIP_CONTENTS; pass; CONTENTS: pass; diag("Sending 1-page stores query to check contents..."); $iDebug = 0; $iDump = 0; tm_run_test('normal', 'shmi ccg', 1, 99, $iDebug, $iDump); my @ara; push @ara, [ url => like => qr{\Ahttp://(cgi|www)\d*\.ebay\.com}, 'result URL is really from ebay.com' ]; push @ara, [ title => ne => q{''}, 'result title is not empty', ]; push @ara, [ description => like => qr{([0-9]+|no)\s+bids?}, 'bid count is ok', ]; # Don't bother checking the end_date or change_date, because eBay # stores are most likely to have only buy-it-now items (which do not # have dates) WWW::Search::Test::test_most_results(\@ara); pass; SKIP_CONTENTS: pass; __END__ WWW-Search-Ebay-3.031/t/pod.t0000644000175000017500000000027510624047566015063 0ustar martinmartin# $Id: pod.t,v 1.1 2007/05/20 13:39:02 Daddy Exp $ use Test::More; eval "use Test::Pod 1.00"; plan skip_all => "Test::Pod 1.00 required for testing POD" if $@; all_pod_files_ok(); __END__ WWW-Search-Ebay-3.031/t/buyitnow.t0000644000175000017500000000512212161637410016144 0ustar martinmartin # $Id: buyitnow.t,v 1.19 2013/06/23 18:31:36 martin Exp $ use blib; use Bit::Vector; use Data::Dumper; use Date::Manip; use Test::More no_plan; use WWW::Search::Test; BEGIN { use_ok('WWW::Search::Ebay::BuyItNow'); } my $iDebug; my $iDump = 0; tm_new_engine('Ebay::BuyItNow'); # goto MULTI_RESULT; # goto DEBUG_NOW; # goto CONTENTS; diag("Sending 0-page buy-it-now query..."); $iDebug = 0; # This test returns no results (but we should not get an HTTP error): tm_run_test('normal', $WWW::Search::Test::bogus_query, 0, 0, $iDebug); # DEBUG_NOW: pass; MULTI_RESULT: { $TODO = 'WWW::Search::Ebay can not fetch multiple pages'; diag("Sending multi-page buy-it-now query..."); $iDebug = 0; $iDump = 0; # This query returns hundreds of pages of results: tm_run_test('normal', 'LEGO', 222, undef, $iDebug); cmp_ok(1, '<', $WWW::Search::Test::oSearch->{requests_made}, 'got multiple pages'); $TODO = ''; } # DEBUG_NOW: pass; TODO: { $TODO = 'sometimes there are too many of this book for sale'; diag("Sending 1-page buy-it-now query for 12-digit UPC..."); $iDebug = 0; $iDump = 0; tm_run_test('normal', '0-77778-60672-7' , 1, 99, $iDebug, $iDump); $TODO = ''; } # end of TODO pass; TODO: { $TODO = 'sometimes there are zero of this item'; diag("Sending 1-page buy-it-now query for 13-digit EAN..."); $iDebug = 0; $iDump = 0; tm_run_test('normal', '00-75678-26382-8' , 1, 99, $iDebug, $iDump); $TODO = ''; } DEBUG_NOW: diag("Sending 1-page buy-it-now query for 10-digit ISBN..."); TODO: { $TODO = 'sometimes there are none of this book for sale'; $iDebug = 0; $iDump = 0; tm_run_test('normal', '0-395-52021-5' , 1, 99, $iDebug, $iDump); $TODO = ''; } # end of TODO block # goto SKIP_CONTENTS; CONTENTS: diag("Sending 1-page buy-it-now query to check contents..."); $iDebug = 0; $iDump = 0; $WWW::Search::Test::sSaveOnError = q{buyitnow-failed.html}; tm_run_test('normal', 'Kenya waterfall', 1, 199, $iDebug, $iDump); # Now get the results and inspect them: my @ao = $WWW::Search::Test::oSearch->results(); cmp_ok(0, '<', scalar(@ao), 'got some results'); my @ara; push @ara, [ url => like => qr{\Ahttp://(cgi|www)\d*\.ebay\.com}, 'result URL is really from ebay.com' ]; push @ara, [ title => ne => q{''}, 'result title is not empty', ]; push @ara, [ description => like => qr{no\s+bids;}, 'bid count is ok', ]; push @ara, [ description => like => qr{starting\sbid}, 'result bid amount is ok' ]; WWW::Search::Test::test_most_results(\@ara); SKIP_CONTENTS: ; __END__ WWW-Search-Ebay-3.031/t/bysellerid.t0000644000175000017500000000402312207527016016422 0ustar martinmartin # $Id: bysellerid.t,v 1.18 2013/08/20 22:16:26 Martin Exp $ use Date::Manip; use ExtUtils::testlib; use Test::More no_plan; use WWW::Search; use WWW::Search::Test; BEGIN { use_ok('WWW::Search::Ebay::BySellerID'); } # end of BEGIN block my $iDebug; my $iDump; tm_new_engine('Ebay::BySellerID'); # goto DEBUG_NOW; # goto CONTENTS; diag("Sending 0-page seller ID query..."); $iDebug = 0; $iDump = 0; # This test returns no results (but we should not get an HTTP error): tm_run_test('normal', $WWW::Search::Test::bogus_query, 0, 0, $iDebug, $iDump); goto SKIP_MULTI; pass('no-op'); # DEBUG_NOW: pass('no-op'); MULTI_RESULT: { $TODO = 'WWW::Search::Ebay can not fetch multiple pages'; diag("Sending multi-page seller ID query..."); $iDebug = 0; $iDump = 0; # This query returns many pages of results: tm_run_test('normal', 'toymom21957', 200, undef, $iDebug); cmp_ok(1, '<', $WWW::Search::Test::oSearch->{requests_made}, 'got multiple pages'); $TODO = q{}; } DEBUG_NOW: pass('no-op'); SKIP_MULTI: pass('no-op'); CONTENTS: diag("Sending 1-page seller ID query to check contents..."); $iDebug = 0; $iDump = 0; $WWW::Search::Test::sSaveOnError = q{bysellerid-failed.html}; # local $TODO = 'Too hard to find a seller with consistently one page of auctions'; tm_run_test('normal', 'the-candy-man-can', 1, 199, $iDebug, $iDump); # Now get the results and inspect them: my @ao = $WWW::Search::Test::oSearch->results(); cmp_ok(0, '<', scalar(@ao), 'got some results'); my @ara = ( ['url', 'like', qr{\Ahttp://(cgi|www)\d*\.ebay\.com}, 'URL is really from ebay.com'], ['title', 'ne', 'q{}', 'Title is not empty'], ['change_date', 'date', 'change_date is really a date'], ['description', 'like', qr{Item #\d+;}, 'description contains item #'], ['description', 'like', qr{\b(\d+|no)\s+bids?}, # }, # Emacs bug 'result bidcount is ok'], ['bid_count', 'like', qr{\A\d+\Z}, 'bid_count is a number'], ); WWW::Search::Test::test_most_results(\@ara, 0.95); __END__ WWW-Search-Ebay-3.031/t/category.t0000644000175000017500000000470112114543261016101 0ustar martinmartin # $Id: category.t,v 1.3 2013/03/03 03:42:41 Martin Exp $ use blib; use Bit::Vector; use Data::Dumper; use Test::More no_plan; use WWW::Search::Test; BEGIN { use_ok('WWW::Search::Ebay::Category'); } my $iDebug; my $iDump = 0; tm_new_engine('Ebay::Category'); # goto MULTI_RESULT; # goto DEBUG_NOW; # goto CONTENTS; diag("Sending 0-page category query..."); $iDebug = 0; # This test returns no results (but we should not get an HTTP error): tm_run_test('normal', $WWW::Search::Test::bogus_query, 0, 0, $iDebug); # DEBUG_NOW: pass; MULTI_RESULT: { $TODO = 'WWW::Search::Ebay can not fetch multiple pages'; diag("Sending multi-page category query..."); $iDebug = 0; $iDump = 0; # This query returns dozens of pages of results: tm_run_test('normal', '1380', 222, undef, $iDebug); cmp_ok(1, '<', $WWW::Search::Test::oSearch->{requests_made}, 'got multiple pages'); $TODO = ''; } # end of MULTI_RESULT block DEBUG_NOW: pass; CONTENTS: diag("Sending 1-page category query to check contents..."); $iDebug = 0; $iDump = 0; $WWW::Search::Test::sSaveOnError = q{category-failed.html}; tm_run_test('normal', 1381, 1, 199, $iDebug, $iDump); # Now get the results and inspect them: my @ao = $WWW::Search::Test::oSearch->results(); cmp_ok(0, '<', scalar(@ao), 'got some results'); # We perform this many tests on each result object: my $iTests = 5; my $iAnyFailed = 0; my ($iVall, %hash); my $oV = new Bit::Vector($iTests); $oV->Fill; $iVall = $oV->to_Dec; foreach my $oResult (@ao) { $oV->Bit_Off(0) unless like($oResult->url, qr{\Ahttp://(cgi|www)\d*\.ebay\.com}, 'result URL is really from ebay.com'); $oV->Bit_Off(1) unless cmp_ok($oResult->title, 'ne', '', 'result Title is not empty'); $oV->Bit_Off(2) if ! cmp_ok($oResult->end_date, 'ne', '', 'result end_date is not empty'); $oV->Bit_Off(3) unless like($oResult->description, qr{(\d+|no)\sbids?;}, 'result bid count is ok'); $oV->Bit_Off(4) unless like($oResult->description, qr{(starting|current)\sbid\s}, 'result bid amount is ok'); my $iV = $oV->to_Dec; if ($iV < $iVall) { $hash{$iV} = $oResult; $iAnyFailed++; } # if } # foreach if ($iAnyFailed) { diag(" Here are results that exemplify the failures:"); while (my ($sKey, $sVal) = each %hash) { diag(Dumper($sVal)); } # while } # if SKIP_CONTENTS: ; __END__ WWW-Search-Ebay-3.031/t/enddate.t0000644000175000017500000000316712114543261015675 0ustar martinmartin # $Id: enddate.t,v 1.13 2013/03/03 03:42:41 Martin Exp $ use strict; use warnings; use blib; use Data::Dumper; use Date::Manip; $ENV{TZ} = 'EST5EDT'; Date_Init('TZ=EST5EDT'); use ExtUtils::testlib; use Test::More 'no_plan'; use WWW::Search; use WWW::Search::Test; use constant DEBUG_DATE => 0; my $iDebug = 0; my $iDump = 0; tm_new_engine('Ebay::ByEndDate'); # goto TEST_NOW; pass('no-op'); TEST_NOW: pass('no-op'); diag("Sending end-date query..."); $iDebug = 0; $iDump = 0; # We need a query that returns "Featured Items" _and_ items that end # in a few minutes. This one attracts Rock'n'Roll fans and # philatelists: TODO: { $TODO = 'We only need one page of results in order to test the end-date sort'; tm_run_test('normal', 'zeppelin', 45, 49, $iDebug, $iDump); } $TODO = ''; # goto ALL_DONE; # for debugging # Now get some ByEndDate results and inspect them: my @ao = $WWW::Search::Test::oSearch->results(); cmp_ok(0, '<', scalar(@ao), 'got some results'); my $sDatePrev = 'yesterday'; foreach my $oResult (@ao) { like($oResult->url, qr{\Ahttp://(cgi|www)\d*\.ebay\.com}, 'result URL really is from ebay.com'); cmp_ok($oResult->title, 'ne', '', 'result Title is not empty'); like($oResult->description, qr{([0-9]+|no)\s+bids?}, 'result bidcount is ok'); my $sDate = $oResult->change_date || ''; DEBUG_DATE && diag(qq{raw result date is '$sDate'}); diag(Dumper($oResult)) unless isnt($sDate, ''); my $iCmp = Date_Cmp($sDatePrev, $sDate); cmp_ok($iCmp, '<=', 0, 'result is in order by end date'); $sDatePrev = $sDate; } # foreach pass('no-op'); ALL_DONE: pass('no-op'); exit 0; __END__ WWW-Search-Ebay-3.031/t/coverage.t0000644000175000017500000000206010360103221016040 0ustar martinmartin # $Id: coverage.t,v 1.4 2006/01/08 03:27:13 Daddy Exp $ use ExtUtils::testlib; use Test::More no_plan; use IO::Capture::Stderr; my $oICE = IO::Capture::Stderr->new; BEGIN { use_ok('WWW::Search') }; BEGIN { use_ok('WWW::Search::Ebay') }; my $iDebug; my $iDump = 0; my $o = new WWW::Search('Ebay'); $o->{_debug} = 1; $oICE->start; # Trigger all the options-list handling: $o->native_query('junk', { search_debug => 1, search_parse_debug => 1, foo => 'bar', search_foo => undef, baz => undef, }, ); $oICE->stop; my $o1 = new WWW::Search('Ebay'); # Call native_query with no options: $o1->native_query('junk'); # Do an actual search with debugging turned on: $oICE->start; $o1->native_query('star wars taco bell', { search_debug => 1, search_parse_debug => 1, }, ); $o1->next_result; $oICE->stop; exit 0; __END__ WWW-Search-Ebay-3.031/t/itemnumber.t0000644000175000017500000000072012114543261016430 0ustar martinmartin # $Id: itemnumber.t,v 1.15 2013/03/03 03:42:41 Martin Exp $ use Data::Dumper; use ExtUtils::testlib; use Test::More no_plan; use WWW::Search::Test; BEGIN { use_ok('WWW::Search::Ebay'); } # end of BEGIN block use strict; my $iDebug; my $iDump; tm_new_engine('Ebay'); $iDebug = 0; $iDump = 0; TODO: { our $TODO = q{If you really need this functionality, notify the author}; tm_run_test('normal', '140920371428', 1, 1, $iDebug, $iDump); } __END__ WWW-Search-Ebay-3.031/t/motors.t0000644000175000017500000000360712161735755015630 0ustar martinmartin # $Id: motors.t,v 1.21 2013/06/24 03:24:29 martin Exp $ use ExtUtils::testlib; use Test::More no_plan; use WWW::Search::Test; use constant DEBUG_ONE => 0; BEGIN { use_ok('WWW::Search::Ebay::Motors'); } my $iDebug; my $iDump = 0; tm_new_engine('Ebay::Motors'); DEBUG_ONE && goto TEST_ONE; # goto CONTENTS; if (0) { diag("Sending 0-page motors query..."); $iDebug = 1; # This test returns no results (but we should not get an HTTP error): tm_run_test('normal', $WWW::Search::Test::bogus_query, 0, 0, $iDebug); } # if pass(q{start multi-page test}); MULTI_RESULT: { $TODO = 'WWW::Search::Ebay can not fetch multiple pages'; diag("Sending multi-page motors query..."); $iDebug = 0; $iDump = 0; # This query should return hundreds of pages of results: tm_run_test('normal', 'Chevrolet', 111, undef, $iDebug, $iDump); cmp_ok(1, '<', $WWW::Search::Test::oSearch->{requests_made}, 'got multiple pages'); $TODO = q{}; } # goto SKIP_CONTENTS; DEBUG_NOW: pass; CONTENTS: pass; TEST_ONE: pass('start 1-page test'); diag("Sending 1-page motors query to check contents..."); $iDebug = 0; $iDump = 0; $WWW::Search::Test::sSaveOnError = q{motors-1-failed.html}; tm_run_test('normal', '2008 Bugatti Veyron', 1, 49, $iDebug, $iDump); # Now get the results and inspect them: my @ara; push @ara, [ url => like => qr{\Ahttp://(cgi|www)\d*\.ebay\.com}, 'result URL is really from ebay.com' ]; push @ara, [ title => ne => q{''}, 'result title is not empty', ]; push @ara, [ end_date => ne => q{''}, 'result end_date is not empty', ]; push @ara, [ description => like => qr{([0-9]+|no)\s+bids?}, 'bid count is ok', ]; push @ara, [ description => like => qr{starting\sbid}, 'result bid amount is ok' ]; WWW::Search::Test::test_most_results(\@ara); SKIP_CONTENTS: pass('all done'); __END__ WWW-Search-Ebay-3.031/t/pod-coverage.t0000644000175000017500000000131711237425627016651 0ustar martinmartin # $Id: pod-coverage.t,v 1.2 2009/08/09 01:51:19 Martin Exp $ use strict; use warnings; use Test::More; use blib; # BEGIN { sub Pod::Coverage::TRACE_ALL () { 1 } } # BEGIN { sub TRACE_ALL () { 1 } } # Ensure a recent version of Test::Pod::Coverage my $min_tpc = 1.08; eval "use Test::Pod::Coverage $min_tpc"; plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage" if $@; # Test::Pod::Coverage doesn't require a minimum Pod::Coverage version, # but older versions don't recognize some common documentation styles my $min_pc = 0.18; eval "use Pod::Coverage $min_pc"; plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage" if $@; all_pod_coverage_ok(); __END__ WWW-Search-Ebay-3.031/t/ebay.t0000644000175000017500000001044012207530047015202 0ustar martinmartin # $Id: ebay.t,v 1.18 2013/08/29 02:21:27 martin Exp $ use strict; use warnings; use constant DEBUG_CONTENTS => 0; use Bit::Vector; use Data::Dumper; use Date::Manip; Date_Init('TZ=-0500'); use ExtUtils::testlib; use Test::More 'no_plan'; use WWW::Search; use WWW::Search::Test; BEGIN { use_ok('WWW::Search::Ebay'); } my $iDebug; my $iDump = 0; tm_new_engine('Ebay'); # goto ISBN; # goto DEBUG_NOW; goto CONTENTS if DEBUG_CONTENTS; # goto SPELL_TEST; diag("Sending 0-page ebay queries..."); $iDebug = 0; # This test returns no results (but we should not get an HTTP error): tm_run_test('normal', $WWW::Search::Test::bogus_query, 0, 0, $iDebug); SPELL_TEST: pass('no-op'); # There are no hits for "laavar", make sure Ebay.pm does not return # the "lavar" hits: $iDebug = 0; # tm_run_test('normal', 'laavar', 0, 0, $iDebug, 'dump'); $iDebug = 0; # tm_run_test('normal', 'no products match this entire phrase', 0, 0, $iDebug, 'dump'); # goto ALL_DONE; DEBUG_NOW: pass('no-op'); MULTI_RESULT: { $TODO = 'WWW::Search::Ebay can not fetch multiple pages'; diag("Sending multi-page ebay query..."); $iDebug = 0; $iDump = 0; # This query returns hundreds of pages of results: tm_run_test('normal', 'LEGO', 101, undef, $iDebug); cmp_ok(1, '<', $WWW::Search::Test::oSearch->{requests_made}, 'got multiple pages'); $TODO = ''; } # end of MULTI_PAGE block # goto SKIP_CONTENTS; # for debugging if (0) { # The intention of this test block is to retrieve a page that # returns hits on the exact query term, AND hits on alternate # spellings. It's just too hard to find such a word that # consistently performs as needed. $TODO = "Sometimes there are NO hits for lavarr"; diag("Sending 1-page ebay queries..."); # There are a few hits for "lavarr", and eBay also gives us all the # "lavar" hits: $iDebug = 0; tm_run_test('normal', 'lavarr', 1, 99, $iDebug); $TODO = ''; } # if UPC: { $TODO = 'too hard to find a consistent EAN'; diag("Sending 1-page ebay query for 12-digit UPC..."); $iDebug = 0; $iDump = 0; tm_run_test('normal', '0-77778-60672-7' , 1, 99, $iDebug, $iDump); $TODO = ''; } # end of UPC block EAN: { $TODO = 'too hard to find a consistent EAN'; diag("Sending 1-page ebay query for 13-digit EAN..."); $iDebug = 0; $iDump = 0; tm_run_test('normal', '00-77778-60672-7' , 1, 99, $iDebug, $iDump); $TODO = ''; } # end of EAN block ISBN: { $TODO = q{I don't know why, but this test has more false negatives than almost any other}; diag("Sending 1-page ebay query for 10-digit ISBN..."); $iDebug = 0; $iDump = 0; tm_run_test('normal', '0-553-09606-0' , 1, 99, $iDebug, $iDump); $TODO = q{}; } # end of ISBN block # goto SKIP_CONTENTS; CONTENTS: diag("Sending 1-page ebay query to check contents..."); $iDebug = DEBUG_CONTENTS ? 2 : 0; $iDump = 0; $WWW::Search::Test::sSaveOnError = q{ebay-1-failed.html}; # }; # Emacs bug my $sQuery = 'trinidad tobago flag'; # $sQuery = 'church spread wings'; # Special debugging tm_run_test('normal', $sQuery, 1, 99, $iDebug, $iDump); # Now get the results and inspect them: my @ao = $WWW::Search::Test::oSearch->results(); cmp_ok(0, '<', scalar(@ao), 'got some results'); my $sBidPattern = 'bid\s+'. $WWW::Search::Test::oSearch->_currency_pattern .'\s?[,.0-9]+'; my $qrBid = qr{\b$sBidPattern}; my @ara = ( ['description', 'like', $qrBid, 'description contains bid amount'], ['description', 'like', qr{Item #\d+;}, 'description contains item #'], ['url', 'like', qr(\Ahttp://(cgi|www)\d*\.ebay\.com), # ), # Emacs bug q'URL is from ebay.com'], # '], # Emacs bug ['title', 'ne', 'q{}', 'result Title is not empty'], ['change_date', 'date', 'change_date is really a date'], ['description', 'like', qr{\b(\d+|no)\s+bids?}, # }, # Emacs bug 'result bidcount is ok'], ['bid_count', 'like', qr{\A\d+\Z}, 'bid_count is a number'], # ['shipping', 'like', qr{\A(free|[0-9\$\.]+)\Z}i, 'shipping looks like a money value'], ['category', 'like', qr{\A-?\d+\Z}, 'category is a number'], ); WWW::Search::Test::test_most_results(\@ara, 1.00); # Sanity check for new category list parsing: # print STDERR Dumper($WWW::Search::Test::oSearch->{categories}); SKIP_CONTENTS: pass('no-op'); ALL_DONE: pass('all done'); __END__ WWW-Search-Ebay-3.031/META.yml0000644000175000017500000000154412207530045015106 0ustar martinmartin--- abstract: 'backend for searching www.ebay.com' author: - "Martin 'Kingpin' Thurn, C, L." build_requires: Bit::Vector: 0 Date::Manip: 0 ExtUtils::MakeMaker: 6.36 IO::Capture::Stderr: 0 Test::More: 0 WWW::Search::Test: 2.29 configure_requires: ExtUtils::MakeMaker: 6.36 distribution_type: module dynamic_config: 1 generated_by: 'Module::Install version 1.06' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 module_name: WWW::Search::Ebay name: WWW-Search-Ebay no_index: directory: - inc - t recommends: Test::Pod: 0 Test::Pod::Coverage: 0 requires: Date::Manip: 0 HTML::TreeBuilder: 0 LWP::Simple: 0 WWW::Search: 2.557 WWW::SearchResult: 2.067 perl: 5.005 resources: license: http://dev.perl.org/licenses/ version: 3.031 WWW-Search-Ebay-3.031/MYMETA.yml0000644000175000017500000000154612207530045015356 0ustar martinmartin--- abstract: 'backend for searching www.ebay.com' author: - "Martin 'Kingpin' Thurn, C, L." build_requires: Bit::Vector: 0 Date::Manip: 0 ExtUtils::MakeMaker: 6.36 IO::Capture::Stderr: 0 Test::More: 0 WWW::Search::Test: 2.29 configure_requires: ExtUtils::MakeMaker: 6.36 dynamic_config: 0 generated_by: 'Module::Install version 1.06, CPAN::Meta::Converter version 2.131560' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: WWW-Search-Ebay no_index: directory: - inc - t recommends: Test::Pod: 0 Test::Pod::Coverage: 0 requires: Date::Manip: 0 HTML::TreeBuilder: 0 LWP::Simple: 0 WWW::Search: 2.557 WWW::SearchResult: 2.067 resources: license: http://dev.perl.org/licenses/ version: 3.029 x_module_name: WWW::Search::Ebay WWW-Search-Ebay-3.031/inc/0000755000175000017500000000000012207530063014402 5ustar martinmartinWWW-Search-Ebay-3.031/inc/Module/0000755000175000017500000000000012207530063015627 5ustar martinmartinWWW-Search-Ebay-3.031/inc/Module/Install/0000755000175000017500000000000012207530063017235 5ustar martinmartinWWW-Search-Ebay-3.031/inc/Module/Install/Win32.pm0000644000175000017500000000340312207530045020475 0ustar martinmartin#line 1 package Module::Install::Win32; use strict; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.06'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } # determine if the user needs nmake, and download it if needed sub check_nmake { my $self = shift; $self->load('can_run'); $self->load('get_file'); require Config; return unless ( $^O eq 'MSWin32' and $Config::Config{make} and $Config::Config{make} =~ /^nmake\b/i and ! $self->can_run('nmake') ); print "The required 'nmake' executable not found, fetching it...\n"; require File::Basename; my $rv = $self->get_file( url => 'http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/Nmake15.exe', ftp_url => 'ftp://ftp.microsoft.com/Softlib/MSLFILES/Nmake15.exe', local_dir => File::Basename::dirname($^X), size => 51928, run => 'Nmake15.exe /o > nul', check_for => 'Nmake.exe', remove => 1, ); die <<'END_MESSAGE' unless $rv; ------------------------------------------------------------------------------- Since you are using Microsoft Windows, you will need the 'nmake' utility before installation. It's available at: http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/Nmake15.exe or ftp://ftp.microsoft.com/Softlib/MSLFILES/Nmake15.exe Please download the file manually, save it to a directory in %PATH% (e.g. C:\WINDOWS\COMMAND\), then launch the MS-DOS command line shell, "cd" to that directory, and run "Nmake15.exe" from there; that will create the 'nmake.exe' file needed by this module. You may then resume the installation process described in README. ------------------------------------------------------------------------------- END_MESSAGE } 1; WWW-Search-Ebay-3.031/inc/Module/Install/Makefile.pm0000644000175000017500000002743712207530045021325 0ustar martinmartin#line 1 package Module::Install::Makefile; use strict 'vars'; use ExtUtils::MakeMaker (); use Module::Install::Base (); use Fcntl qw/:flock :seek/; use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.06'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } sub Makefile { $_[0] } my %seen = (); sub prompt { shift; # Infinite loop protection my @c = caller(); if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) { die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])"; } # In automated testing or non-interactive session, always use defaults if ( ($ENV{AUTOMATED_TESTING} or -! -t STDIN) and ! $ENV{PERL_MM_USE_DEFAULT} ) { local $ENV{PERL_MM_USE_DEFAULT} = 1; goto &ExtUtils::MakeMaker::prompt; } else { goto &ExtUtils::MakeMaker::prompt; } } # Store a cleaned up version of the MakeMaker version, # since we need to behave differently in a variety of # ways based on the MM version. my $makemaker = eval $ExtUtils::MakeMaker::VERSION; # If we are passed a param, do a "newer than" comparison. # Otherwise, just return the MakeMaker version. sub makemaker { ( @_ < 2 or $makemaker >= eval($_[1]) ) ? $makemaker : 0 } # Ripped from ExtUtils::MakeMaker 6.56, and slightly modified # as we only need to know here whether the attribute is an array # or a hash or something else (which may or may not be appendable). my %makemaker_argtype = ( C => 'ARRAY', CONFIG => 'ARRAY', # CONFIGURE => 'CODE', # ignore DIR => 'ARRAY', DL_FUNCS => 'HASH', DL_VARS => 'ARRAY', EXCLUDE_EXT => 'ARRAY', EXE_FILES => 'ARRAY', FUNCLIST => 'ARRAY', H => 'ARRAY', IMPORTS => 'HASH', INCLUDE_EXT => 'ARRAY', LIBS => 'ARRAY', # ignore '' MAN1PODS => 'HASH', MAN3PODS => 'HASH', META_ADD => 'HASH', META_MERGE => 'HASH', PL_FILES => 'HASH', PM => 'HASH', PMLIBDIRS => 'ARRAY', PMLIBPARENTDIRS => 'ARRAY', PREREQ_PM => 'HASH', CONFIGURE_REQUIRES => 'HASH', SKIP => 'ARRAY', TYPEMAPS => 'ARRAY', XS => 'HASH', # VERSION => ['version',''], # ignore # _KEEP_AFTER_FLUSH => '', clean => 'HASH', depend => 'HASH', dist => 'HASH', dynamic_lib=> 'HASH', linkext => 'HASH', macro => 'HASH', postamble => 'HASH', realclean => 'HASH', test => 'HASH', tool_autosplit => 'HASH', # special cases where you can use makemaker_append CCFLAGS => 'APPENDABLE', DEFINE => 'APPENDABLE', INC => 'APPENDABLE', LDDLFLAGS => 'APPENDABLE', LDFROM => 'APPENDABLE', ); sub makemaker_args { my ($self, %new_args) = @_; my $args = ( $self->{makemaker_args} ||= {} ); foreach my $key (keys %new_args) { if ($makemaker_argtype{$key}) { if ($makemaker_argtype{$key} eq 'ARRAY') { $args->{$key} = [] unless defined $args->{$key}; unless (ref $args->{$key} eq 'ARRAY') { $args->{$key} = [$args->{$key}] } push @{$args->{$key}}, ref $new_args{$key} eq 'ARRAY' ? @{$new_args{$key}} : $new_args{$key}; } elsif ($makemaker_argtype{$key} eq 'HASH') { $args->{$key} = {} unless defined $args->{$key}; foreach my $skey (keys %{ $new_args{$key} }) { $args->{$key}{$skey} = $new_args{$key}{$skey}; } } elsif ($makemaker_argtype{$key} eq 'APPENDABLE') { $self->makemaker_append($key => $new_args{$key}); } } else { if (defined $args->{$key}) { warn qq{MakeMaker attribute "$key" is overriden; use "makemaker_append" to append values\n}; } $args->{$key} = $new_args{$key}; } } return $args; } # For mm args that take multiple space-seperated args, # append an argument to the current list. sub makemaker_append { my $self = shift; my $name = shift; my $args = $self->makemaker_args; $args->{$name} = defined $args->{$name} ? join( ' ', $args->{$name}, @_ ) : join( ' ', @_ ); } sub build_subdirs { my $self = shift; my $subdirs = $self->makemaker_args->{DIR} ||= []; for my $subdir (@_) { push @$subdirs, $subdir; } } sub clean_files { my $self = shift; my $clean = $self->makemaker_args->{clean} ||= {}; %$clean = ( %$clean, FILES => join ' ', grep { length $_ } ($clean->{FILES} || (), @_), ); } sub realclean_files { my $self = shift; my $realclean = $self->makemaker_args->{realclean} ||= {}; %$realclean = ( %$realclean, FILES => join ' ', grep { length $_ } ($realclean->{FILES} || (), @_), ); } sub libs { my $self = shift; my $libs = ref $_[0] ? shift : [ shift ]; $self->makemaker_args( LIBS => $libs ); } sub inc { my $self = shift; $self->makemaker_args( INC => shift ); } sub _wanted_t { } sub tests_recursive { my $self = shift; my $dir = shift || 't'; unless ( -d $dir ) { die "tests_recursive dir '$dir' does not exist"; } my %tests = map { $_ => 1 } split / /, ($self->tests || ''); require File::Find; File::Find::find( sub { /\.t$/ and -f $_ and $tests{"$File::Find::dir/*.t"} = 1 }, $dir ); $self->tests( join ' ', sort keys %tests ); } sub write { my $self = shift; die "&Makefile->write() takes no arguments\n" if @_; # Check the current Perl version my $perl_version = $self->perl_version; if ( $perl_version ) { eval "use $perl_version; 1" or die "ERROR: perl: Version $] is installed, " . "but we need version >= $perl_version"; } # Make sure we have a new enough MakeMaker require ExtUtils::MakeMaker; if ( $perl_version and $self->_cmp($perl_version, '5.006') >= 0 ) { # This previous attempted to inherit the version of # ExtUtils::MakeMaker in use by the module author, but this # was found to be untenable as some authors build releases # using future dev versions of EU:MM that nobody else has. # Instead, #toolchain suggests we use 6.59 which is the most # stable version on CPAN at time of writing and is, to quote # ribasushi, "not terminally fucked, > and tested enough". # TODO: We will now need to maintain this over time to push # the version up as new versions are released. $self->build_requires( 'ExtUtils::MakeMaker' => 6.59 ); $self->configure_requires( 'ExtUtils::MakeMaker' => 6.59 ); } else { # Allow legacy-compatibility with 5.005 by depending on the # most recent EU:MM that supported 5.005. $self->build_requires( 'ExtUtils::MakeMaker' => 6.36 ); $self->configure_requires( 'ExtUtils::MakeMaker' => 6.36 ); } # Generate the MakeMaker params my $args = $self->makemaker_args; $args->{DISTNAME} = $self->name; $args->{NAME} = $self->module_name || $self->name; $args->{NAME} =~ s/-/::/g; $args->{VERSION} = $self->version or die <<'EOT'; ERROR: Can't determine distribution version. Please specify it explicitly via 'version' in Makefile.PL, or set a valid $VERSION in a module, and provide its file path via 'version_from' (or 'all_from' if you prefer) in Makefile.PL. EOT if ( $self->tests ) { my @tests = split ' ', $self->tests; my %seen; $args->{test} = { TESTS => (join ' ', grep {!$seen{$_}++} @tests), }; } elsif ( $Module::Install::ExtraTests::use_extratests ) { # Module::Install::ExtraTests doesn't set $self->tests and does its own tests via harness. # So, just ignore our xt tests here. } elsif ( -d 'xt' and ($Module::Install::AUTHOR or $ENV{RELEASE_TESTING}) ) { $args->{test} = { TESTS => join( ' ', map { "$_/*.t" } grep { -d $_ } qw{ t xt } ), }; } if ( $] >= 5.005 ) { $args->{ABSTRACT} = $self->abstract; $args->{AUTHOR} = join ', ', @{$self->author || []}; } if ( $self->makemaker(6.10) ) { $args->{NO_META} = 1; #$args->{NO_MYMETA} = 1; } if ( $self->makemaker(6.17) and $self->sign ) { $args->{SIGN} = 1; } unless ( $self->is_admin ) { delete $args->{SIGN}; } if ( $self->makemaker(6.31) and $self->license ) { $args->{LICENSE} = $self->license; } my $prereq = ($args->{PREREQ_PM} ||= {}); %$prereq = ( %$prereq, map { @$_ } # flatten [module => version] map { @$_ } grep $_, ($self->requires) ); # Remove any reference to perl, PREREQ_PM doesn't support it delete $args->{PREREQ_PM}->{perl}; # Merge both kinds of requires into BUILD_REQUIRES my $build_prereq = ($args->{BUILD_REQUIRES} ||= {}); %$build_prereq = ( %$build_prereq, map { @$_ } # flatten [module => version] map { @$_ } grep $_, ($self->configure_requires, $self->build_requires) ); # Remove any reference to perl, BUILD_REQUIRES doesn't support it delete $args->{BUILD_REQUIRES}->{perl}; # Delete bundled dists from prereq_pm, add it to Makefile DIR my $subdirs = ($args->{DIR} || []); if ($self->bundles) { my %processed; foreach my $bundle (@{ $self->bundles }) { my ($mod_name, $dist_dir) = @$bundle; delete $prereq->{$mod_name}; $dist_dir = File::Basename::basename($dist_dir); # dir for building this module if (not exists $processed{$dist_dir}) { if (-d $dist_dir) { # List as sub-directory to be processed by make push @$subdirs, $dist_dir; } # Else do nothing: the module is already present on the system $processed{$dist_dir} = undef; } } } unless ( $self->makemaker('6.55_03') ) { %$prereq = (%$prereq,%$build_prereq); delete $args->{BUILD_REQUIRES}; } if ( my $perl_version = $self->perl_version ) { eval "use $perl_version; 1" or die "ERROR: perl: Version $] is installed, " . "but we need version >= $perl_version"; if ( $self->makemaker(6.48) ) { $args->{MIN_PERL_VERSION} = $perl_version; } } if ($self->installdirs) { warn qq{old INSTALLDIRS (probably set by makemaker_args) is overriden by installdirs\n} if $args->{INSTALLDIRS}; $args->{INSTALLDIRS} = $self->installdirs; } my %args = map { ( $_ => $args->{$_} ) } grep {defined($args->{$_} ) } keys %$args; my $user_preop = delete $args{dist}->{PREOP}; if ( my $preop = $self->admin->preop($user_preop) ) { foreach my $key ( keys %$preop ) { $args{dist}->{$key} = $preop->{$key}; } } my $mm = ExtUtils::MakeMaker::WriteMakefile(%args); $self->fix_up_makefile($mm->{FIRST_MAKEFILE} || 'Makefile'); } sub fix_up_makefile { my $self = shift; my $makefile_name = shift; my $top_class = ref($self->_top) || ''; my $top_version = $self->_top->VERSION || ''; my $preamble = $self->preamble ? "# Preamble by $top_class $top_version\n" . $self->preamble : ''; my $postamble = "# Postamble by $top_class $top_version\n" . ($self->postamble || ''); local *MAKEFILE; open MAKEFILE, "+< $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!"; eval { flock MAKEFILE, LOCK_EX }; my $makefile = do { local $/; }; $makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /; $makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g; $makefile =~ s/( "-I\$\(INST_LIB\)")/ "-Iinc"$1/g; $makefile =~ s/^(FULLPERL = .*)/$1 "-Iinc"/m; $makefile =~ s/^(PERL = .*)/$1 "-Iinc"/m; # Module::Install will never be used to build the Core Perl # Sometimes PERL_LIB and PERL_ARCHLIB get written anyway, which breaks # PREFIX/PERL5LIB, and thus, install_share. Blank them if they exist $makefile =~ s/^PERL_LIB = .+/PERL_LIB =/m; #$makefile =~ s/^PERL_ARCHLIB = .+/PERL_ARCHLIB =/m; # Perl 5.005 mentions PERL_LIB explicitly, so we have to remove that as well. $makefile =~ s/(\"?)-I\$\(PERL_LIB\)\1//g; # XXX - This is currently unused; not sure if it breaks other MM-users # $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg; seek MAKEFILE, 0, SEEK_SET; truncate MAKEFILE, 0; print MAKEFILE "$preamble$makefile$postamble" or die $!; close MAKEFILE or die $!; 1; } sub preamble { my ($self, $text) = @_; $self->{preamble} = $text . $self->{preamble} if defined $text; $self->{preamble}; } sub postamble { my ($self, $text) = @_; $self->{postamble} ||= $self->admin->postamble; $self->{postamble} .= $text if defined $text; $self->{postamble} } 1; __END__ #line 544 WWW-Search-Ebay-3.031/inc/Module/Install/Metadata.pm0000644000175000017500000004327712207530045021330 0ustar martinmartin#line 1 package Module::Install::Metadata; use strict 'vars'; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.06'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } my @boolean_keys = qw{ sign }; my @scalar_keys = qw{ name module_name abstract version distribution_type tests installdirs }; my @tuple_keys = qw{ configure_requires build_requires requires recommends bundles resources }; my @resource_keys = qw{ homepage bugtracker repository }; my @array_keys = qw{ keywords author }; *authors = \&author; sub Meta { shift } sub Meta_BooleanKeys { @boolean_keys } sub Meta_ScalarKeys { @scalar_keys } sub Meta_TupleKeys { @tuple_keys } sub Meta_ResourceKeys { @resource_keys } sub Meta_ArrayKeys { @array_keys } foreach my $key ( @boolean_keys ) { *$key = sub { my $self = shift; if ( defined wantarray and not @_ ) { return $self->{values}->{$key}; } $self->{values}->{$key} = ( @_ ? $_[0] : 1 ); return $self; }; } foreach my $key ( @scalar_keys ) { *$key = sub { my $self = shift; return $self->{values}->{$key} if defined wantarray and !@_; $self->{values}->{$key} = shift; return $self; }; } foreach my $key ( @array_keys ) { *$key = sub { my $self = shift; return $self->{values}->{$key} if defined wantarray and !@_; $self->{values}->{$key} ||= []; push @{$self->{values}->{$key}}, @_; return $self; }; } foreach my $key ( @resource_keys ) { *$key = sub { my $self = shift; unless ( @_ ) { return () unless $self->{values}->{resources}; return map { $_->[1] } grep { $_->[0] eq $key } @{ $self->{values}->{resources} }; } return $self->{values}->{resources}->{$key} unless @_; my $uri = shift or die( "Did not provide a value to $key()" ); $self->resources( $key => $uri ); return 1; }; } foreach my $key ( grep { $_ ne "resources" } @tuple_keys) { *$key = sub { my $self = shift; return $self->{values}->{$key} unless @_; my @added; while ( @_ ) { my $module = shift or last; my $version = shift || 0; push @added, [ $module, $version ]; } push @{ $self->{values}->{$key} }, @added; return map {@$_} @added; }; } # Resource handling my %lc_resource = map { $_ => 1 } qw{ homepage license bugtracker repository }; sub resources { my $self = shift; while ( @_ ) { my $name = shift or last; my $value = shift or next; if ( $name eq lc $name and ! $lc_resource{$name} ) { die("Unsupported reserved lowercase resource '$name'"); } $self->{values}->{resources} ||= []; push @{ $self->{values}->{resources} }, [ $name, $value ]; } $self->{values}->{resources}; } # Aliases for build_requires that will have alternative # meanings in some future version of META.yml. sub test_requires { shift->build_requires(@_) } sub install_requires { shift->build_requires(@_) } # Aliases for installdirs options sub install_as_core { $_[0]->installdirs('perl') } sub install_as_cpan { $_[0]->installdirs('site') } sub install_as_site { $_[0]->installdirs('site') } sub install_as_vendor { $_[0]->installdirs('vendor') } sub dynamic_config { my $self = shift; my $value = @_ ? shift : 1; if ( $self->{values}->{dynamic_config} ) { # Once dynamic we never change to static, for safety return 0; } $self->{values}->{dynamic_config} = $value ? 1 : 0; return 1; } # Convenience command sub static_config { shift->dynamic_config(0); } sub perl_version { my $self = shift; return $self->{values}->{perl_version} unless @_; my $version = shift or die( "Did not provide a value to perl_version()" ); # Normalize the version $version = $self->_perl_version($version); # We don't support the really old versions unless ( $version >= 5.005 ) { die "Module::Install only supports 5.005 or newer (use ExtUtils::MakeMaker)\n"; } $self->{values}->{perl_version} = $version; } sub all_from { my ( $self, $file ) = @_; unless ( defined($file) ) { my $name = $self->name or die( "all_from called with no args without setting name() first" ); $file = join('/', 'lib', split(/-/, $name)) . '.pm'; $file =~ s{.*/}{} unless -e $file; unless ( -e $file ) { die("all_from cannot find $file from $name"); } } unless ( -f $file ) { die("The path '$file' does not exist, or is not a file"); } $self->{values}{all_from} = $file; # Some methods pull from POD instead of code. # If there is a matching .pod, use that instead my $pod = $file; $pod =~ s/\.pm$/.pod/i; $pod = $file unless -e $pod; # Pull the different values $self->name_from($file) unless $self->name; $self->version_from($file) unless $self->version; $self->perl_version_from($file) unless $self->perl_version; $self->author_from($pod) unless @{$self->author || []}; $self->license_from($pod) unless $self->license; $self->abstract_from($pod) unless $self->abstract; return 1; } sub provides { my $self = shift; my $provides = ( $self->{values}->{provides} ||= {} ); %$provides = (%$provides, @_) if @_; return $provides; } sub auto_provides { my $self = shift; return $self unless $self->is_admin; unless (-e 'MANIFEST') { warn "Cannot deduce auto_provides without a MANIFEST, skipping\n"; return $self; } # Avoid spurious warnings as we are not checking manifest here. local $SIG{__WARN__} = sub {1}; require ExtUtils::Manifest; local *ExtUtils::Manifest::manicheck = sub { return }; require Module::Build; my $build = Module::Build->new( dist_name => $self->name, dist_version => $self->version, license => $self->license, ); $self->provides( %{ $build->find_dist_packages || {} } ); } sub feature { my $self = shift; my $name = shift; my $features = ( $self->{values}->{features} ||= [] ); my $mods; if ( @_ == 1 and ref( $_[0] ) ) { # The user used ->feature like ->features by passing in the second # argument as a reference. Accomodate for that. $mods = $_[0]; } else { $mods = \@_; } my $count = 0; push @$features, ( $name => [ map { ref($_) ? ( ref($_) eq 'HASH' ) ? %$_ : @$_ : $_ } @$mods ] ); return @$features; } sub features { my $self = shift; while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) { $self->feature( $name, @$mods ); } return $self->{values}->{features} ? @{ $self->{values}->{features} } : (); } sub no_index { my $self = shift; my $type = shift; push @{ $self->{values}->{no_index}->{$type} }, @_ if $type; return $self->{values}->{no_index}; } sub read { my $self = shift; $self->include_deps( 'YAML::Tiny', 0 ); require YAML::Tiny; my $data = YAML::Tiny::LoadFile('META.yml'); # Call methods explicitly in case user has already set some values. while ( my ( $key, $value ) = each %$data ) { next unless $self->can($key); if ( ref $value eq 'HASH' ) { while ( my ( $module, $version ) = each %$value ) { $self->can($key)->($self, $module => $version ); } } else { $self->can($key)->($self, $value); } } return $self; } sub write { my $self = shift; return $self unless $self->is_admin; $self->admin->write_meta; return $self; } sub version_from { require ExtUtils::MM_Unix; my ( $self, $file ) = @_; $self->version( ExtUtils::MM_Unix->parse_version($file) ); # for version integrity check $self->makemaker_args( VERSION_FROM => $file ); } sub abstract_from { require ExtUtils::MM_Unix; my ( $self, $file ) = @_; $self->abstract( bless( { DISTNAME => $self->name }, 'ExtUtils::MM_Unix' )->parse_abstract($file) ); } # Add both distribution and module name sub name_from { my ($self, $file) = @_; if ( Module::Install::_read($file) =~ m/ ^ \s* package \s* ([\w:]+) \s* ; /ixms ) { my ($name, $module_name) = ($1, $1); $name =~ s{::}{-}g; $self->name($name); unless ( $self->module_name ) { $self->module_name($module_name); } } else { die("Cannot determine name from $file\n"); } } sub _extract_perl_version { if ( $_[0] =~ m/ ^\s* (?:use|require) \s* v? ([\d_\.]+) \s* ; /ixms ) { my $perl_version = $1; $perl_version =~ s{_}{}g; return $perl_version; } else { return; } } sub perl_version_from { my $self = shift; my $perl_version=_extract_perl_version(Module::Install::_read($_[0])); if ($perl_version) { $self->perl_version($perl_version); } else { warn "Cannot determine perl version info from $_[0]\n"; return; } } sub author_from { my $self = shift; my $content = Module::Install::_read($_[0]); if ($content =~ m/ =head \d \s+ (?:authors?)\b \s* ([^\n]*) | =head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s* .*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s* ([^\n]*) /ixms) { my $author = $1 || $2; # XXX: ugly but should work anyway... if (eval "require Pod::Escapes; 1") { # Pod::Escapes has a mapping table. # It's in core of perl >= 5.9.3, and should be installed # as one of the Pod::Simple's prereqs, which is a prereq # of Pod::Text 3.x (see also below). $author =~ s{ E<( (\d+) | ([A-Za-z]+) )> } { defined $2 ? chr($2) : defined $Pod::Escapes::Name2character_number{$1} ? chr($Pod::Escapes::Name2character_number{$1}) : do { warn "Unknown escape: E<$1>"; "E<$1>"; }; }gex; } elsif (eval "require Pod::Text; 1" && $Pod::Text::VERSION < 3) { # Pod::Text < 3.0 has yet another mapping table, # though the table name of 2.x and 1.x are different. # (1.x is in core of Perl < 5.6, 2.x is in core of # Perl < 5.9.3) my $mapping = ($Pod::Text::VERSION < 2) ? \%Pod::Text::HTML_Escapes : \%Pod::Text::ESCAPES; $author =~ s{ E<( (\d+) | ([A-Za-z]+) )> } { defined $2 ? chr($2) : defined $mapping->{$1} ? $mapping->{$1} : do { warn "Unknown escape: E<$1>"; "E<$1>"; }; }gex; } else { $author =~ s{E}{<}g; $author =~ s{E}{>}g; } $self->author($author); } else { warn "Cannot determine author info from $_[0]\n"; } } #Stolen from M::B my %license_urls = ( perl => 'http://dev.perl.org/licenses/', apache => 'http://apache.org/licenses/LICENSE-2.0', apache_1_1 => 'http://apache.org/licenses/LICENSE-1.1', artistic => 'http://opensource.org/licenses/artistic-license.php', artistic_2 => 'http://opensource.org/licenses/artistic-license-2.0.php', lgpl => 'http://opensource.org/licenses/lgpl-license.php', lgpl2 => 'http://opensource.org/licenses/lgpl-2.1.php', lgpl3 => 'http://opensource.org/licenses/lgpl-3.0.html', bsd => 'http://opensource.org/licenses/bsd-license.php', gpl => 'http://opensource.org/licenses/gpl-license.php', gpl2 => 'http://opensource.org/licenses/gpl-2.0.php', gpl3 => 'http://opensource.org/licenses/gpl-3.0.html', mit => 'http://opensource.org/licenses/mit-license.php', mozilla => 'http://opensource.org/licenses/mozilla1.1.php', open_source => undef, unrestricted => undef, restrictive => undef, unknown => undef, ); sub license { my $self = shift; return $self->{values}->{license} unless @_; my $license = shift or die( 'Did not provide a value to license()' ); $license = __extract_license($license) || lc $license; $self->{values}->{license} = $license; # Automatically fill in license URLs if ( $license_urls{$license} ) { $self->resources( license => $license_urls{$license} ); } return 1; } sub _extract_license { my $pod = shift; my $matched; return __extract_license( ($matched) = $pod =~ m/ (=head \d \s+ L(?i:ICEN[CS]E|ICENSING)\b.*?) (=head \d.*|=cut.*|)\z /xms ) || __extract_license( ($matched) = $pod =~ m/ (=head \d \s+ (?:C(?i:OPYRIGHTS?)|L(?i:EGAL))\b.*?) (=head \d.*|=cut.*|)\z /xms ); } sub __extract_license { my $license_text = shift or return; my @phrases = ( '(?:under )?the same (?:terms|license) as (?:perl|the perl (?:\d )?programming language)' => 'perl', 1, '(?:under )?the terms of (?:perl|the perl programming language) itself' => 'perl', 1, 'Artistic and GPL' => 'perl', 1, 'GNU general public license' => 'gpl', 1, 'GNU public license' => 'gpl', 1, 'GNU lesser general public license' => 'lgpl', 1, 'GNU lesser public license' => 'lgpl', 1, 'GNU library general public license' => 'lgpl', 1, 'GNU library public license' => 'lgpl', 1, 'GNU Free Documentation license' => 'unrestricted', 1, 'GNU Affero General Public License' => 'open_source', 1, '(?:Free)?BSD license' => 'bsd', 1, 'Artistic license 2\.0' => 'artistic_2', 1, 'Artistic license' => 'artistic', 1, 'Apache (?:Software )?license' => 'apache', 1, 'GPL' => 'gpl', 1, 'LGPL' => 'lgpl', 1, 'BSD' => 'bsd', 1, 'Artistic' => 'artistic', 1, 'MIT' => 'mit', 1, 'Mozilla Public License' => 'mozilla', 1, 'Q Public License' => 'open_source', 1, 'OpenSSL License' => 'unrestricted', 1, 'SSLeay License' => 'unrestricted', 1, 'zlib License' => 'open_source', 1, 'proprietary' => 'proprietary', 0, ); while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) { $pattern =~ s#\s+#\\s+#gs; if ( $license_text =~ /\b$pattern\b/i ) { return $license; } } return ''; } sub license_from { my $self = shift; if (my $license=_extract_license(Module::Install::_read($_[0]))) { $self->license($license); } else { warn "Cannot determine license info from $_[0]\n"; return 'unknown'; } } sub _extract_bugtracker { my @links = $_[0] =~ m#L<( https?\Q://rt.cpan.org/\E[^>]+| https?\Q://github.com/\E[\w_]+/[\w_]+/issues| https?\Q://code.google.com/p/\E[\w_\-]+/issues/list )>#gx; my %links; @links{@links}=(); @links=keys %links; return @links; } sub bugtracker_from { my $self = shift; my $content = Module::Install::_read($_[0]); my @links = _extract_bugtracker($content); unless ( @links ) { warn "Cannot determine bugtracker info from $_[0]\n"; return 0; } if ( @links > 1 ) { warn "Found more than one bugtracker link in $_[0]\n"; return 0; } # Set the bugtracker bugtracker( $links[0] ); return 1; } sub requires_from { my $self = shift; my $content = Module::Install::_readperl($_[0]); my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+(v?[\d\.]+)/mg; while ( @requires ) { my $module = shift @requires; my $version = shift @requires; $self->requires( $module => $version ); } } sub test_requires_from { my $self = shift; my $content = Module::Install::_readperl($_[0]); my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg; while ( @requires ) { my $module = shift @requires; my $version = shift @requires; $self->test_requires( $module => $version ); } } # Convert triple-part versions (eg, 5.6.1 or 5.8.9) to # numbers (eg, 5.006001 or 5.008009). # Also, convert double-part versions (eg, 5.8) sub _perl_version { my $v = $_[-1]; $v =~ s/^([1-9])\.([1-9]\d?\d?)$/sprintf("%d.%03d",$1,$2)/e; $v =~ s/^([1-9])\.([1-9]\d?\d?)\.(0|[1-9]\d?\d?)$/sprintf("%d.%03d%03d",$1,$2,$3 || 0)/e; $v =~ s/(\.\d\d\d)000$/$1/; $v =~ s/_.+$//; if ( ref($v) ) { # Numify $v = $v + 0; } return $v; } sub add_metadata { my $self = shift; my %hash = @_; for my $key (keys %hash) { warn "add_metadata: $key is not prefixed with 'x_'.\n" . "Use appopriate function to add non-private metadata.\n" unless $key =~ /^x_/; $self->{values}->{$key} = $hash{$key}; } } ###################################################################### # MYMETA Support sub WriteMyMeta { die "WriteMyMeta has been deprecated"; } sub write_mymeta_yaml { my $self = shift; # We need YAML::Tiny to write the MYMETA.yml file unless ( eval { require YAML::Tiny; 1; } ) { return 1; } # Generate the data my $meta = $self->_write_mymeta_data or return 1; # Save as the MYMETA.yml file print "Writing MYMETA.yml\n"; YAML::Tiny::DumpFile('MYMETA.yml', $meta); } sub write_mymeta_json { my $self = shift; # We need JSON to write the MYMETA.json file unless ( eval { require JSON; 1; } ) { return 1; } # Generate the data my $meta = $self->_write_mymeta_data or return 1; # Save as the MYMETA.yml file print "Writing MYMETA.json\n"; Module::Install::_write( 'MYMETA.json', JSON->new->pretty(1)->canonical->encode($meta), ); } sub _write_mymeta_data { my $self = shift; # If there's no existing META.yml there is nothing we can do return undef unless -f 'META.yml'; # We need Parse::CPAN::Meta to load the file unless ( eval { require Parse::CPAN::Meta; 1; } ) { return undef; } # Merge the perl version into the dependencies my $val = $self->Meta->{values}; my $perl = delete $val->{perl_version}; if ( $perl ) { $val->{requires} ||= []; my $requires = $val->{requires}; # Canonize to three-dot version after Perl 5.6 if ( $perl >= 5.006 ) { $perl =~ s{^(\d+)\.(\d\d\d)(\d*)}{join('.', $1, int($2||0), int($3||0))}e } unshift @$requires, [ perl => $perl ]; } # Load the advisory META.yml file my @yaml = Parse::CPAN::Meta::LoadFile('META.yml'); my $meta = $yaml[0]; # Overwrite the non-configure dependency hashs delete $meta->{requires}; delete $meta->{build_requires}; delete $meta->{recommends}; if ( exists $val->{requires} ) { $meta->{requires} = { map { @$_ } @{ $val->{requires} } }; } if ( exists $val->{build_requires} ) { $meta->{build_requires} = { map { @$_ } @{ $val->{build_requires} } }; } return $meta; } 1; WWW-Search-Ebay-3.031/inc/Module/Install/Can.pm0000644000175000017500000000615712207530045020305 0ustar martinmartin#line 1 package Module::Install::Can; use strict; use Config (); use ExtUtils::MakeMaker (); use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.06'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } # check if we can load some module ### Upgrade this to not have to load the module if possible sub can_use { my ($self, $mod, $ver) = @_; $mod =~ s{::|\\}{/}g; $mod .= '.pm' unless $mod =~ /\.pm$/i; my $pkg = $mod; $pkg =~ s{/}{::}g; $pkg =~ s{\.pm$}{}i; local $@; eval { require $mod; $pkg->VERSION($ver || 0); 1 }; } # Check if we can run some command sub can_run { my ($self, $cmd) = @_; my $_cmd = $cmd; return $_cmd if (-x $_cmd or $_cmd = MM->maybe_command($_cmd)); for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') { next if $dir eq ''; require File::Spec; my $abs = File::Spec->catfile($dir, $cmd); return $abs if (-x $abs or $abs = MM->maybe_command($abs)); } return; } # Can our C compiler environment build XS files sub can_xs { my $self = shift; # Ensure we have the CBuilder module $self->configure_requires( 'ExtUtils::CBuilder' => 0.27 ); # Do we have the configure_requires checker? local $@; eval "require ExtUtils::CBuilder;"; if ( $@ ) { # They don't obey configure_requires, so it is # someone old and delicate. Try to avoid hurting # them by falling back to an older simpler test. return $self->can_cc(); } # Do we have a working C compiler my $builder = ExtUtils::CBuilder->new( quiet => 1, ); unless ( $builder->have_compiler ) { # No working C compiler return 0; } # Write a C file representative of what XS becomes require File::Temp; my ( $FH, $tmpfile ) = File::Temp::tempfile( "compilexs-XXXXX", SUFFIX => '.c', ); binmode $FH; print $FH <<'END_C'; #include "EXTERN.h" #include "perl.h" #include "XSUB.h" int main(int argc, char **argv) { return 0; } int boot_sanexs() { return 1; } END_C close $FH; # Can the C compiler access the same headers XS does my @libs = (); my $object = undef; eval { local $^W = 0; $object = $builder->compile( source => $tmpfile, ); @libs = $builder->link( objects => $object, module_name => 'sanexs', ); }; my $result = $@ ? 0 : 1; # Clean up all the build files foreach ( $tmpfile, $object, @libs ) { next unless defined $_; 1 while unlink; } return $result; } # Can we locate a (the) C compiler sub can_cc { my $self = shift; my @chunks = split(/ /, $Config::Config{cc}) or return; # $Config{cc} may contain args; try to find out the program part while (@chunks) { return $self->can_run("@chunks") || (pop(@chunks), next); } return; } # Fix Cygwin bug on maybe_command(); if ( $^O eq 'cygwin' ) { require ExtUtils::MM_Cygwin; require ExtUtils::MM_Win32; if ( ! defined(&ExtUtils::MM_Cygwin::maybe_command) ) { *ExtUtils::MM_Cygwin::maybe_command = sub { my ($self, $file) = @_; if ($file =~ m{^/cygdrive/}i and ExtUtils::MM_Win32->can('maybe_command')) { ExtUtils::MM_Win32->maybe_command($file); } else { ExtUtils::MM_Unix->maybe_command($file); } } } } 1; __END__ #line 236 WWW-Search-Ebay-3.031/inc/Module/Install/Fetch.pm0000644000175000017500000000462712207530045020635 0ustar martinmartin#line 1 package Module::Install::Fetch; use strict; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.06'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } sub get_file { my ($self, %args) = @_; my ($scheme, $host, $path, $file) = $args{url} =~ m|^(\w+)://([^/]+)(.+)/(.+)| or return; if ( $scheme eq 'http' and ! eval { require LWP::Simple; 1 } ) { $args{url} = $args{ftp_url} or (warn("LWP support unavailable!\n"), return); ($scheme, $host, $path, $file) = $args{url} =~ m|^(\w+)://([^/]+)(.+)/(.+)| or return; } $|++; print "Fetching '$file' from $host... "; unless (eval { require Socket; Socket::inet_aton($host) }) { warn "'$host' resolve failed!\n"; return; } return unless $scheme eq 'ftp' or $scheme eq 'http'; require Cwd; my $dir = Cwd::getcwd(); chdir $args{local_dir} or return if exists $args{local_dir}; if (eval { require LWP::Simple; 1 }) { LWP::Simple::mirror($args{url}, $file); } elsif (eval { require Net::FTP; 1 }) { eval { # use Net::FTP to get past firewall my $ftp = Net::FTP->new($host, Passive => 1, Timeout => 600); $ftp->login("anonymous", 'anonymous@example.com'); $ftp->cwd($path); $ftp->binary; $ftp->get($file) or (warn("$!\n"), return); $ftp->quit; } } elsif (my $ftp = $self->can_run('ftp')) { eval { # no Net::FTP, fallback to ftp.exe require FileHandle; my $fh = FileHandle->new; local $SIG{CHLD} = 'IGNORE'; unless ($fh->open("|$ftp -n")) { warn "Couldn't open ftp: $!\n"; chdir $dir; return; } my @dialog = split(/\n/, <<"END_FTP"); open $host user anonymous anonymous\@example.com cd $path binary get $file $file quit END_FTP foreach (@dialog) { $fh->print("$_\n") } $fh->close; } } else { warn "No working 'ftp' program available!\n"; chdir $dir; return; } unless (-f $file) { warn "Fetching failed: $@\n"; chdir $dir; return; } return if exists $args{size} and -s $file != $args{size}; system($args{run}) if exists $args{run}; unlink($file) if $args{remove}; print(((!exists $args{check_for} or -e $args{check_for}) ? "done!" : "failed! ($!)"), "\n"); chdir $dir; return !$?; } 1; WWW-Search-Ebay-3.031/inc/Module/Install/WriteAll.pm0000644000175000017500000000237612207530045021326 0ustar martinmartin#line 1 package Module::Install::WriteAll; use strict; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.06'; @ISA = qw{Module::Install::Base}; $ISCORE = 1; } sub WriteAll { my $self = shift; my %args = ( meta => 1, sign => 0, inline => 0, check_nmake => 1, @_, ); $self->sign(1) if $args{sign}; $self->admin->WriteAll(%args) if $self->is_admin; $self->check_nmake if $args{check_nmake}; unless ( $self->makemaker_args->{PL_FILES} ) { # XXX: This still may be a bit over-defensive... unless ($self->makemaker(6.25)) { $self->makemaker_args( PL_FILES => {} ) if -f 'Build.PL'; } } # Until ExtUtils::MakeMaker support MYMETA.yml, make sure # we clean it up properly ourself. $self->realclean_files('MYMETA.yml'); if ( $args{inline} ) { $self->Inline->write; } else { $self->Makefile->write; } # The Makefile write process adds a couple of dependencies, # so write the META.yml files after the Makefile. if ( $args{meta} ) { $self->Meta->write; } # Experimental support for MYMETA if ( $ENV{X_MYMETA} ) { if ( $ENV{X_MYMETA} eq 'JSON' ) { $self->Meta->write_mymeta_json; } else { $self->Meta->write_mymeta_yaml; } } return 1; } 1; WWW-Search-Ebay-3.031/inc/Module/Install/Base.pm0000644000175000017500000000214712207530045020451 0ustar martinmartin#line 1 package Module::Install::Base; use strict 'vars'; use vars qw{$VERSION}; BEGIN { $VERSION = '1.06'; } # Suspend handler for "redefined" warnings BEGIN { my $w = $SIG{__WARN__}; $SIG{__WARN__} = sub { $w }; } #line 42 sub new { my $class = shift; unless ( defined &{"${class}::call"} ) { *{"${class}::call"} = sub { shift->_top->call(@_) }; } unless ( defined &{"${class}::load"} ) { *{"${class}::load"} = sub { shift->_top->load(@_) }; } bless { @_ }, $class; } #line 61 sub AUTOLOAD { local $@; my $func = eval { shift->_top->autoload } or return; goto &$func; } #line 75 sub _top { $_[0]->{_top}; } #line 90 sub admin { $_[0]->_top->{admin} or Module::Install::Base::FakeAdmin->new; } #line 106 sub is_admin { ! $_[0]->admin->isa('Module::Install::Base::FakeAdmin'); } sub DESTROY {} package Module::Install::Base::FakeAdmin; use vars qw{$VERSION}; BEGIN { $VERSION = $Module::Install::Base::VERSION; } my $fake; sub new { $fake ||= bless(\@_, $_[0]); } sub AUTOLOAD {} sub DESTROY {} # Restore warning handler BEGIN { $SIG{__WARN__} = $SIG{__WARN__}->(); } 1; #line 159 WWW-Search-Ebay-3.031/inc/Module/Install.pm0000644000175000017500000003013512207530045017575 0ustar martinmartin#line 1 package Module::Install; # For any maintainers: # The load order for Module::Install is a bit magic. # It goes something like this... # # IF ( host has Module::Install installed, creating author mode ) { # 1. Makefile.PL calls "use inc::Module::Install" # 2. $INC{inc/Module/Install.pm} set to installed version of inc::Module::Install # 3. The installed version of inc::Module::Install loads # 4. inc::Module::Install calls "require Module::Install" # 5. The ./inc/ version of Module::Install loads # } ELSE { # 1. Makefile.PL calls "use inc::Module::Install" # 2. $INC{inc/Module/Install.pm} set to ./inc/ version of Module::Install # 3. The ./inc/ version of Module::Install loads # } use 5.005; use strict 'vars'; use Cwd (); use File::Find (); use File::Path (); use vars qw{$VERSION $MAIN}; BEGIN { # All Module::Install core packages now require synchronised versions. # This will be used to ensure we don't accidentally load old or # different versions of modules. # This is not enforced yet, but will be some time in the next few # releases once we can make sure it won't clash with custom # Module::Install extensions. $VERSION = '1.06'; # Storage for the pseudo-singleton $MAIN = undef; *inc::Module::Install::VERSION = *VERSION; @inc::Module::Install::ISA = __PACKAGE__; } sub import { my $class = shift; my $self = $class->new(@_); my $who = $self->_caller; #------------------------------------------------------------- # all of the following checks should be included in import(), # to allow "eval 'require Module::Install; 1' to test # installation of Module::Install. (RT #51267) #------------------------------------------------------------- # Whether or not inc::Module::Install is actually loaded, the # $INC{inc/Module/Install.pm} is what will still get set as long as # the caller loaded module this in the documented manner. # If not set, the caller may NOT have loaded the bundled version, and thus # they may not have a MI version that works with the Makefile.PL. This would # result in false errors or unexpected behaviour. And we don't want that. my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm'; unless ( $INC{$file} ) { die <<"END_DIE" } Please invoke ${\__PACKAGE__} with: use inc::${\__PACKAGE__}; not: use ${\__PACKAGE__}; END_DIE # This reportedly fixes a rare Win32 UTC file time issue, but # as this is a non-cross-platform XS module not in the core, # we shouldn't really depend on it. See RT #24194 for detail. # (Also, this module only supports Perl 5.6 and above). eval "use Win32::UTCFileTime" if $^O eq 'MSWin32' && $] >= 5.006; # If the script that is loading Module::Install is from the future, # then make will detect this and cause it to re-run over and over # again. This is bad. Rather than taking action to touch it (which # is unreliable on some platforms and requires write permissions) # for now we should catch this and refuse to run. if ( -f $0 ) { my $s = (stat($0))[9]; # If the modification time is only slightly in the future, # sleep briefly to remove the problem. my $a = $s - time; if ( $a > 0 and $a < 5 ) { sleep 5 } # Too far in the future, throw an error. my $t = time; if ( $s > $t ) { die <<"END_DIE" } Your installer $0 has a modification time in the future ($s > $t). This is known to create infinite loops in make. Please correct this, then run $0 again. END_DIE } # Build.PL was formerly supported, but no longer is due to excessive # difficulty in implementing every single feature twice. if ( $0 =~ /Build.PL$/i ) { die <<"END_DIE" } Module::Install no longer supports Build.PL. It was impossible to maintain duel backends, and has been deprecated. Please remove all Build.PL files and only use the Makefile.PL installer. END_DIE #------------------------------------------------------------- # To save some more typing in Module::Install installers, every... # use inc::Module::Install # ...also acts as an implicit use strict. $^H |= strict::bits(qw(refs subs vars)); #------------------------------------------------------------- unless ( -f $self->{file} ) { foreach my $key (keys %INC) { delete $INC{$key} if $key =~ /Module\/Install/; } local $^W; require "$self->{path}/$self->{dispatch}.pm"; File::Path::mkpath("$self->{prefix}/$self->{author}"); $self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self ); $self->{admin}->init; @_ = ($class, _self => $self); goto &{"$self->{name}::import"}; } local $^W; *{"${who}::AUTOLOAD"} = $self->autoload; $self->preload; # Unregister loader and worker packages so subdirs can use them again delete $INC{'inc/Module/Install.pm'}; delete $INC{'Module/Install.pm'}; # Save to the singleton $MAIN = $self; return 1; } sub autoload { my $self = shift; my $who = $self->_caller; my $cwd = Cwd::cwd(); my $sym = "${who}::AUTOLOAD"; $sym->{$cwd} = sub { my $pwd = Cwd::cwd(); if ( my $code = $sym->{$pwd} ) { # Delegate back to parent dirs goto &$code unless $cwd eq $pwd; } unless ($$sym =~ s/([^:]+)$//) { # XXX: it looks like we can't retrieve the missing function # via $$sym (usually $main::AUTOLOAD) in this case. # I'm still wondering if we should slurp Makefile.PL to # get some context or not ... my ($package, $file, $line) = caller; die <<"EOT"; Unknown function is found at $file line $line. Execution of $file aborted due to runtime errors. If you're a contributor to a project, you may need to install some Module::Install extensions from CPAN (or other repository). If you're a user of a module, please contact the author. EOT } my $method = $1; if ( uc($method) eq $method ) { # Do nothing return; } elsif ( $method =~ /^_/ and $self->can($method) ) { # Dispatch to the root M:I class return $self->$method(@_); } # Dispatch to the appropriate plugin unshift @_, ( $self, $1 ); goto &{$self->can('call')}; }; } sub preload { my $self = shift; unless ( $self->{extensions} ) { $self->load_extensions( "$self->{prefix}/$self->{path}", $self ); } my @exts = @{$self->{extensions}}; unless ( @exts ) { @exts = $self->{admin}->load_all_extensions; } my %seen; foreach my $obj ( @exts ) { while (my ($method, $glob) = each %{ref($obj) . '::'}) { next unless $obj->can($method); next if $method =~ /^_/; next if $method eq uc($method); $seen{$method}++; } } my $who = $self->_caller; foreach my $name ( sort keys %seen ) { local $^W; *{"${who}::$name"} = sub { ${"${who}::AUTOLOAD"} = "${who}::$name"; goto &{"${who}::AUTOLOAD"}; }; } } sub new { my ($class, %args) = @_; delete $INC{'FindBin.pm'}; { # to suppress the redefine warning local $SIG{__WARN__} = sub {}; require FindBin; } # ignore the prefix on extension modules built from top level. my $base_path = Cwd::abs_path($FindBin::Bin); unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) { delete $args{prefix}; } return $args{_self} if $args{_self}; $args{dispatch} ||= 'Admin'; $args{prefix} ||= 'inc'; $args{author} ||= ($^O eq 'VMS' ? '_author' : '.author'); $args{bundle} ||= 'inc/BUNDLES'; $args{base} ||= $base_path; $class =~ s/^\Q$args{prefix}\E:://; $args{name} ||= $class; $args{version} ||= $class->VERSION; unless ( $args{path} ) { $args{path} = $args{name}; $args{path} =~ s!::!/!g; } $args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm"; $args{wrote} = 0; bless( \%args, $class ); } sub call { my ($self, $method) = @_; my $obj = $self->load($method) or return; splice(@_, 0, 2, $obj); goto &{$obj->can($method)}; } sub load { my ($self, $method) = @_; $self->load_extensions( "$self->{prefix}/$self->{path}", $self ) unless $self->{extensions}; foreach my $obj (@{$self->{extensions}}) { return $obj if $obj->can($method); } my $admin = $self->{admin} or die <<"END_DIE"; The '$method' method does not exist in the '$self->{prefix}' path! Please remove the '$self->{prefix}' directory and run $0 again to load it. END_DIE my $obj = $admin->load($method, 1); push @{$self->{extensions}}, $obj; $obj; } sub load_extensions { my ($self, $path, $top) = @_; my $should_reload = 0; unless ( grep { ! ref $_ and lc $_ eq lc $self->{prefix} } @INC ) { unshift @INC, $self->{prefix}; $should_reload = 1; } foreach my $rv ( $self->find_extensions($path) ) { my ($file, $pkg) = @{$rv}; next if $self->{pathnames}{$pkg}; local $@; my $new = eval { local $^W; require $file; $pkg->can('new') }; unless ( $new ) { warn $@ if $@; next; } $self->{pathnames}{$pkg} = $should_reload ? delete $INC{$file} : $INC{$file}; push @{$self->{extensions}}, &{$new}($pkg, _top => $top ); } $self->{extensions} ||= []; } sub find_extensions { my ($self, $path) = @_; my @found; File::Find::find( sub { my $file = $File::Find::name; return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is; my $subpath = $1; return if lc($subpath) eq lc($self->{dispatch}); $file = "$self->{path}/$subpath.pm"; my $pkg = "$self->{name}::$subpath"; $pkg =~ s!/!::!g; # If we have a mixed-case package name, assume case has been preserved # correctly. Otherwise, root through the file to locate the case-preserved # version of the package name. if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) { my $content = Module::Install::_read($subpath . '.pm'); my $in_pod = 0; foreach ( split //, $content ) { $in_pod = 1 if /^=\w/; $in_pod = 0 if /^=cut/; next if ($in_pod || /^=cut/); # skip pod text next if /^\s*#/; # and comments if ( m/^\s*package\s+($pkg)\s*;/i ) { $pkg = $1; last; } } } push @found, [ $file, $pkg ]; }, $path ) if -d $path; @found; } ##################################################################### # Common Utility Functions sub _caller { my $depth = 0; my $call = caller($depth); while ( $call eq __PACKAGE__ ) { $depth++; $call = caller($depth); } return $call; } # Done in evals to avoid confusing Perl::MinimumVersion eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@; sub _read { local *FH; open( FH, '<', $_[0] ) or die "open($_[0]): $!"; my $string = do { local $/; }; close FH or die "close($_[0]): $!"; return $string; } END_NEW sub _read { local *FH; open( FH, "< $_[0]" ) or die "open($_[0]): $!"; my $string = do { local $/; }; close FH or die "close($_[0]): $!"; return $string; } END_OLD sub _readperl { my $string = Module::Install::_read($_[0]); $string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg; $string =~ s/(\n)\n*__(?:DATA|END)__\b.*\z/$1/s; $string =~ s/\n\n=\w+.+?\n\n=cut\b.+?\n+/\n\n/sg; return $string; } sub _readpod { my $string = Module::Install::_read($_[0]); $string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg; return $string if $_[0] =~ /\.pod\z/; $string =~ s/(^|\n=cut\b.+?\n+)[^=\s].+?\n(\n=\w+|\z)/$1$2/sg; $string =~ s/\n*=pod\b[^\n]*\n+/\n\n/sg; $string =~ s/\n*=cut\b[^\n]*\n+/\n\n/sg; $string =~ s/^\n+//s; return $string; } # Done in evals to avoid confusing Perl::MinimumVersion eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@; sub _write { local *FH; open( FH, '>', $_[0] ) or die "open($_[0]): $!"; foreach ( 1 .. $#_ ) { print FH $_[$_] or die "print($_[0]): $!"; } close FH or die "close($_[0]): $!"; } END_NEW sub _write { local *FH; open( FH, "> $_[0]" ) or die "open($_[0]): $!"; foreach ( 1 .. $#_ ) { print FH $_[$_] or die "print($_[0]): $!"; } close FH or die "close($_[0]): $!"; } END_OLD # _version is for processing module versions (eg, 1.03_05) not # Perl versions (eg, 5.8.1). sub _version ($) { my $s = shift || 0; my $d =()= $s =~ /(\.)/g; if ( $d >= 2 ) { # Normalise multipart versions $s =~ s/(\.)(\d{1,3})/sprintf("$1%03d",$2)/eg; } $s =~ s/^(\d+)\.?//; my $l = $1 || 0; my @v = map { $_ . '0' x (3 - length $_) } $s =~ /(\d{1,3})\D?/g; $l = $l . '.' . join '', @v if @v; return $l + 0; } sub _cmp ($$) { _version($_[1]) <=> _version($_[2]); } # Cloned from Params::Util::_CLASS sub _CLASS ($) { ( defined $_[0] and ! ref $_[0] and $_[0] =~ m/^[^\W\d]\w*(?:::\w+)*\z/s ) ? $_[0] : undef; } 1; # Copyright 2008 - 2012 Adam Kennedy. WWW-Search-Ebay-3.031/LICENSE0000644000175000017500000000010111077515007014633 0ustar martinmartinThis software is released under the same license as Perl itself. WWW-Search-Ebay-3.031/MYMETA.json0000644000175000017500000000274612207530045015531 0ustar martinmartin{ "abstract" : "backend for searching www.ebay.com", "author" : [ "Martin 'Kingpin' Thurn, C, L." ], "dynamic_config" : 0, "generated_by" : "Module::Install version 1.06, CPAN::Meta::Converter version 2.131560", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "WWW-Search-Ebay", "no_index" : { "directory" : [ "inc", "t" ] }, "prereqs" : { "build" : { "requires" : { "Bit::Vector" : "0", "Date::Manip" : "0", "ExtUtils::MakeMaker" : "6.36", "IO::Capture::Stderr" : "0", "Test::More" : "0", "WWW::Search::Test" : "2.29" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.36" } }, "runtime" : { "recommends" : { "Test::Pod" : "0", "Test::Pod::Coverage" : "0" }, "requires" : { "Date::Manip" : "0", "HTML::TreeBuilder" : "0", "LWP::Simple" : "0", "WWW::Search" : "2.557", "WWW::SearchResult" : "2.067" } } }, "release_status" : "stable", "resources" : { "license" : [ "http://dev.perl.org/licenses/" ] }, "version" : "3.029", "x_module_name" : "WWW::Search::Ebay" } WWW-Search-Ebay-3.031/README0000644000175000017500000000124511106110737014512 0ustar martinmartin This is a backend for use with the WWW::Search module. NOTE NOTE NOTE NOTE NOTE STARTING WITH THE 3.001 DISTRIBUTION OF 2008-11-10, WWW::Search::Ebay IS NOT ABLE TO FOLLOW THE "NEXT" LINK ON THE SEARCH RESULTS PAGE. THEREFORE IT WILL NOT RETURN MORE THAN 200 RESULTS. ==== ==== ==== ==== ==== Please read the README for WWW::Search for general information. (One place to find it is http://www.perl.com/CPAN-local/modules/by-module/WWW/WWW-Search-2.45.readme ) Read the Changes file in this distribution to see what is new with this backend since the previous release. Please visit http://www.sandcrawler.com/SWB/cpan-modules.html for more information.