EBayGlobal.pm

filter: Statementstmt 22.7% 37 / 163 Branchbran 10.8% 10 / 92 Conditioncond 14.8% 4 / 27 MC/DCmcdc 0.0% 0 / 14 Subroutinesub 50.0% 3 / 6 Podpod 33.3% 1 / 3 totaltotal 18.0% 55 / 305 CC 64 SCAR 70.8
CC
64
Cov
18%
parse_tree
1892.0
__ANON__
30.0
native_setup_search
22.4
CRAP 1187.0
↑ Summary EbayUK.pm »
1 # EBayGlobal.pm
2 # Written by Andy Pritchard. Original Ebay backend by Martin Thurn
3 # $Id: EBayGlobal.pm,v 3.00 2003-03-18 15:00:00 Exp $
4  
5 package WWW::Search::EBayGlobal;
6  
7 1 @ISA = qw( WWW::Search );
8  
9 1 ▶use WWW::Search qw( generic_option strip_tags );
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use WWW::Search::Result;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 $VERSION = '3.00';
13 1 $MAINTAINER = 'Andy Pritchard <pilchkinstein@hotmail.com>';
14  
15 # private
16 sub native_setup_search
17 1 ▶ {
Subroutine native_setup_search: called CC=16 SCAR=31.1
Pod undocumented
18 1 my ($self, $native_query, $rhOptsArg) = @_;
19
20 # Set some private variables:
21 1 ▶ $self->{_debug} ||= $rhOptsArg->{'search_debug'};
Condition33%1/3
$self->{"_debug"} ||= $rhOptsArg->{"search_debug"}
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->{"_debug"} ||= $rhOptsArg->{"search_debug"}
$self->{"_debug"} $rhOptsArg->{"search_debug"}
Truth table33%1/3
A ||= B
A= $self->{"_debug"}B= $rhOptsArg->{"search_debug"}
ABresult
1X1
011
000
22 1 ▶ $self->{_debug} = 2 if ($rhOptsArg->{'search_parse_debug'});
Branch: 1 branch
BranchTrueFalseTotal
if $rhOptsArg->{"search_parse_debug"} 0 1 1
23 1 ▶ $self->{_debug} ||= 0;
Condition50%1/2
$self->{"_debug"} ||= 0
l!l
01
MC/DC0%0/1
$self->{"_debug"} ||= 0
$self->{"_debug"}
Truth table50%1/2
A
A= $self->{"_debug"}
Aresult
11
00
24  
25 1 my $seBay_site = $rhOptsArg->{'ebay_site'};
26 1 ▶ $seBay_site ||= 'uk'; # Default to English site
Condition50%1/2
$seBay_site ||= "uk"
l!l
01
MC/DC0%0/1
$seBay_site ||= "uk"
$seBay_site
Truth table50%1/2
A
A= $seBay_site
Aresult
11
00
27 1 my $sWorld_Wide = $rhOptsArg->{'World_Wide'};
28 1 ▶ $sWorld_Wide ||= '2'; # Default to local site
Condition50%1/2
$sWorld_Wide ||= 2
l!l
01
MC/DC0%0/1
$sWorld_Wide ||= 2
$sWorld_Wide
Truth table50%1/2
A
A= $sWorld_Wide
Aresult
11
00
29 1 ▶ ($sWorld_Wide =~ /y/i) ? ($sWorld_Wide = 3) : ($sWorld_Wide = 2);
Branch: 1 branch
BranchTrueFalseTotal
$sWorld_Wide =~ /y/i ? : 0 1 1
30  
31
32 1 %Country_Params = ( uk => 'search.ebay.co.uk',
33 at => 'cq-search.ebay.at',
34 au => 'search.ebay.com.au',
35 # be => is a little tricky since it has the french or netherland variant
36 ca => 'search.ebay.ca',
37 ch => 'cq-search.ebay.ch',
38 de => 'search.ebay.de',
39 fr => 'search.ebay.fr',
40 us => 'search.ebay.com',
41 ) ;
42
43 1 my $DEFAULT_HITS_PER_PAGE = 50;
44 1 $self->{'_hits_per_page'} = $DEFAULT_HITS_PER_PAGE;
45  
46 1 $self->user_agent('non-robot');
47  
48 1 $self->{'_next_to_retrieve'} = 0;
49 1 $self->{'_num_hits'} = 0;
50 1 $self->{'_base_url'} = "http://$Country_Params{$seBay_site}";
51
52 1 ▶ print STDERR " + Country_Params:Site=>\'$seBay_site\':URL=>\'$self->{'_base_url'}\'\n" if 1 < $self->{_debug};
Branch: 1 branch
BranchTrueFalseTotal
if 1 < $self->{"_debug"} 0 1 1
53  
54 1 ▶ if (!defined($self->{_options}))
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_options"}) 1 0 1
55 {
56 $self->{_options} = {
57 1 'search_url' => $self->{'_base_url'} . '/search/search.dll',
58 'MfcISAPICommand' => 'GetResult',
59 'ht' => 1,
60 # Default sort order is reverse-order of listing date:
61 'SortProperty' => 'MetaNewSort',
62 'shortcut' => $sWorld_Wide, # Whether we search worldwide or not set 3 or 2
63 'query' => $native_query,
64 };
65 } # if
66 1 ▶ if (defined($rhOptsArg))
Branch: 1 branch
BranchTrueFalseTotal
if (defined $rhOptsArg) 1 0 1
67 {
68 # Copy in new options.
69 1 foreach my $key (keys %$rhOptsArg)
70 {
71 #print STDERR " + inspecting option $key...";
72 2 ▶ if (WWW::Search::generic_option($key))
Branch: 1 branch
BranchTrueFalseTotal
if (WWW::Search::generic_option($key)) { } 1 1 2
73 {
74 # print STDERR "promote & delete\n";
75 1 ▶ $self->{$key} = $rhOptsArg->{$key} if defined($rhOptsArg->{$key});
Branch: 1 branch
BranchTrueFalseTotal
if defined $rhOptsArg->{$key} 1 0 1
76 1 delete $rhOptsArg->{$key};
77 }
78 else
79 {
80 #print STDERR "copy\n";
81 1 ▶ $self->{_options}->{$key} = $rhOptsArg->{$key} if defined($rhOptsArg->{$key});
Branch: 1 branch
BranchTrueFalseTotal
if defined $rhOptsArg->{$key} 1 0 1
82 }
83 } # foreach
84 } # if
85  
86 # Finally, figure out the url. With extra option to just go for the url supplied.
87 1 ▶ if (defined($self->{_options}->{'follow_link'}))
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{'_options'}{'follow_link'}) { } 0 1 1
88 {
89 0 ▶ print STDERR " + follow_link -->",$self->{_options}->{'follow_link'}, "<--\n" if 1 < $self->{_debug};
Branch: 1 branch
BranchTrueFalseTotal
if 1 < $self->{"_debug"} 0 0 0
90 0 $self->{_next_url} = $self->{_options}->{'follow_link'};
91 }else{
92 1 $self->{_next_url} = $self->{_options}->{'search_url'} .'?'. $self->hash_to_cgi_string($self->{_options});
93 }
94 } # native_setup_search
95  
96  
97 sub preprocess_results_page
98 0 ▶ {
Subroutine preprocess_results_page: not called CC=3 SCAR=24.8
Pod documented
99 0 my $self = shift;
100 0 my $sPage = shift;
101 # Ebay sends malformed HTML:
102 0 my $iSubs = 0 + ($sPage =~ s!</FONT></TD></FONT></TD>!</FONT></TD>!gi);
103 0 ▶ print STDERR " + deleted $iSubs extraneous tags\n" if 1 < $self->{_debug};
Branch: 1 branch
BranchTrueFalseTotal
if 1 < $self->{"_debug"} 0 0 0
104 0 ▶ print STDERR " + RawHTML ===>$sPage<=== RawHTML\n" if 2 < $self->{_debug};
Branch: 1 branch
BranchTrueFalseTotal
if 2 < $self->{"_debug"} 0 0 0
105 0 return $sPage;
106 } # preprocess_results_page
107  
108 package WWW::SearchResult; # Adding new details method
109 sub details { return shift->_elem('details', @_); }
110 package WWW::Search::EBayGlobal;
111  
112 # private
113 sub parse_tree
114 0 ▶ {
Subroutine parse_tree: not called CC=43 SCAR=75.5
Pod undocumented
115 0 my $self = shift;
116 0 my $tree = shift;
117  
118 # A pattern to match HTML whitespace:
119 0 my $W = q{[\ \t\r\n\240]};
120 # A pattern to match Ebay currencies:
121 0 my $currency = qr/(?:\$|C|EUR|GBP|\£|CHF|\€|AUD|AU)/;
122 # One to match time zones for the end date
123 0 my $time_zone = qr/(?:GMT|MEZ|Paris|PST|AEDST|EST)/;
124 # One to match the next tag
125 0 my $next_tag = qr/(?:Next|Nächste|Suivante)/;
126 0 my $hits_found = 0;
127 0 ▶ if (2 < $self->{_debug}) {
Branch: 1 branch
BranchTrueFalseTotal
if (2 < $self->{"_debug"}) 0 0 0
128 0 print STDERR "=========================== HTML::Tree Dump START ============================\n";
129 0 print STDERR $tree->as_HTML();
130 0 print STDERR "============================ HTML::Tree Dump END =============================\n";
131 }
132 # The hit count is in a FONT tag:
133 0 my @aoFONT = $tree->look_down('_tag', 'font');
134 0 ▶ if (defined($self->{_options}->{'follow_link'}))
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"_options"}{"follow_link"}) 0 0 0
135 {
136 0 my($oDetails) = {}; # We can put what we want in here now 'thumbnail' 'Start' 'End' so far
137 0 my($s_nextdate,$sTitle2);
138 0 my @aoTD2 = $tree->look_down('_tag', 'td');
139 0 my @aoIMG2 = $tree->look_down('_tag', 'img');
140
141 FONT_2:
142 0 foreach my $oFONT2 (@aoFONT)
143 # If we run through the retrieve html step, the stuff we want is in here.
144 {
145 0 ▶ print STDERR " + try FONT_2 as_text ===", $oFONT2->as_text, "===\n" if 1 < $self->{_debug};
Branch: 1 branch
BranchTrueFalseTotal
if 1 < $self->{"_debug"} 0 0 0
146 0 ▶ $sTitle2 = $oFONT2->as_text unless ($sTitle2);# The first font entry is the title
Branch: 1 branch
BranchTrueFalseTotal
unless $sTitle2 0 0 0
147 0 foreach my $pDATE ('Start','End') # Alter the spelling here if ebay change it. Shouldnt be needed.
148 {
149 0 ▶ $s_nextdate = $pDATE if ($oFONT2->as_text =~ /${pDATE}/);
Branch: 1 branch
BranchTrueFalseTotal
if $oFONT2->as_text =~ /$pDATE/ 0 0 0
150 0 ▶ if (($oFONT2->as_text =~ m!(\w+(?:\.|\-)\w+(?:\.|\-)\d+\s*\d+:\d+:\d+\s*$time_zone)!) and ($s_nextdate))
Branch: 1 branch
BranchTrueFalseTotal
if ($oFONT2->as_text =~ /(\w+(?:\.|\-)\w+(?:\.|\-)\d+\s*\d+:\d+:\d+\s*$time_zone)/ and $s_nextdate) 0 0 0
Condition0%0/3
$oFONT2->as_text =~ /(\w+(?:\.|\-)\w+(?:\.|\-)\d+\s*\d+:\d+:\d+\s*$time_zone)/ and $s_nextdate
!ll&&!rl&&r
000
MC/DC0%0/2
$oFONT2->as_text =~ /(\w+(?:\.|\-)\w+(?:\.|\-)\d+\s*\d+:\d+:\d+\s*$time_zone)/ and $s_nextdate
$oFONT2->as_text =~ /(\w+(?:\.|\-)\w+(?:\.|\-)\d+\s*\d+:\d+:\d+\s*$time_zone)/ $s_nextdate
Truth table0%0/3
A and B
A= $oFONT2->as_text =~ /(\w+(?:\.|\-)\w+(?:\.|\-)\d+\s*\d+:\d+:\d+\s*$time_zone)/B= $s_nextdate
ABresult
0X0
100
111
151 {
152 0 ▶ next FONT_2 if (defined($oDetails->{$s_nextdate}));
Branch: 1 branch
BranchTrueFalseTotal
if defined $oDetails->{$s_nextdate} 0 0 0
153 0 $oDetails->{$s_nextdate} = $1;
154 0 ▶ if (1 < $self->{_debug})
Branch: 1 branch
BranchTrueFalseTotal
if (1 < $self->{"_debug"}) 0 0 0
155 {
156 0 print STDERR " + Trying to match \'$s_nextdate\'\n";
157 0 print STDERR " == Got a Date ==>${1}\n";
158 0 print STDERR " == Now \$oDetails->{\'$s_nextdate\'} ==>", $oDetails->{$s_nextdate}, "\n";
159 }
160 }
161 }
162 ## Deleting HTML element so that future searches go faster!
163 0 $oFONT2->detach;
164 0 $oFONT2->delete;
165 ## Need to fill what we can of these when we get this far
166 } # foreach FONT_2
167
168 IMG_2:
169 0 foreach my $oIMG2 (@aoIMG2)
170 {
171 0 my $sIMG = $oIMG2->as_HTML;
172 0 chomp($sIMG);
173 0 ▶ print STDERR " + try IMG_2 as_HTML ===$sIMG===\n" if 1 < $self->{_debug};
Branch: 1 branch
BranchTrueFalseTotal
if 1 < $self->{"_debug"} 0 0 0
174 0 ▶ if (($sIMG =~ /border=1/) and ($sIMG =~ /width=\d\d\b/) and ($sIMG =~ /height=\d\d\b/))
Branch: 1 branch
BranchTrueFalseTotal
if ($sIMG =~ /border=1/ and $sIMG =~ /width=\d\d\b/ and $sIMG =~ /height=\d\d\b/) 0 0 0
Condition0%0/6
$sIMG =~ /border=1/ and $sIMG =~ /width=\d\d\b/ and $sIMG =~ /height=\d\d\b/
!ll&&!rl&&r
000
$sIMG =~ /border=1/ and $sIMG =~ /width=\d\d\b/
!ll&&!rl&&r
000
MC/DC0%0/3
$sIMG =~ /border=1/ and $sIMG =~ /width=\d\d\b/ and $sIMG =~ /height=\d\d\b/
$sIMG =~ /border=1/ $sIMG =~ /width=\d\d\b/ $sIMG =~ /height=\d\d\b/
Truth table0%0/4
A and B and C
A= $sIMG =~ /border=1/B= $sIMG =~ /width=\d\d\b/C= $sIMG =~ /height=\d\d\b/
ABCresult
0XX0
10X0
1100
1111
175 {
176 0 $sIMG =~ s/.*src=\"(.*)\".*/$1/;
177 0 ▶ print STDERR " == Got a Thumbnail =>$sIMG<=\n" if 1 < $self->{_debug};
Branch: 1 branch
BranchTrueFalseTotal
if 1 < $self->{"_debug"} 0 0 0
178 0 $oDetails->{'thumbnail'} = $sIMG;
179 }
180 } # foreach IMG_2
181
182 0 my $hit = new WWW::Search::Result;
183 0 $hit->title($sTitle2); # There's really no need to send this since you should have it from page 1.
184 #$hit->description($sDesc);
185 0 $hit->details($oDetails); # This contains extra keys 'thumbnail','Start','End'
186 0 $hit->raw($tree->as_HTML); # This is new to this Backend
187 0 push(@{$self->{cache}}, $hit);
188 0 $hits_found++;
189
190 # Finished with this page now, no next to follow.
191 0 $tree->delete;
192 0 return $hits_found;
193 } # if follow_link defined
194
195 FONT:
196 0 foreach my $oFONT (@aoFONT)
197 {
198 0 ▶ print STDERR " + try FONT ===", $oFONT->as_text, "===\n" if 1 < $self->{_debug};
Branch: 1 branch
BranchTrueFalseTotal
if 1 < $self->{"_debug"} 0 0 0
199 # If we run through the retrieve html step, the stuff we want is in here.
200
201 0 ▶ if ($oFONT->as_text =~ m!(\d+) items found !)
Branch: 1 branch
BranchTrueFalseTotal
if ($oFONT->as_text =~ /(\d+) items found /) 0 0 0
202 {
203 0 $self->approximate_result_count($1);
204 0 last FONT;
205 } # if
206 } # foreach
207
208 # The list of matching items is in a table. The first column of the
209 # table is nothing but icons; the second column is the good stuff.
210 my @aoTD = $tree->look_down('_tag', 'td',
211 0 ▶ sub { (
Subroutine __ANON__: not called CC=5 SCAR=34.0
212 0 ▶ ($_[0]->as_HTML =~ m!ViewItem! )
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->as_HTML =~ /ViewItem/ and not $_[0]->as_HTML =~ /thumbs\.ebay\./ and not $_[0]->as_HTML =~ /alt="\[Picture!\]"/i and not $_[0]->as_HTML =~ /alt="\[Bild!\]"/i and not $_[0]->as_HTML =~ /alt="buyItNow"/i 0 0 0
Condition0%0/9
$_[0]->as_HTML =~ /ViewItem/ and not $_[0]->as_HTML =~ /thumbs\.ebay\./ and not $_[0]->as_HTML =~ /alt="\[Picture!\]"/i and not $_[0]->as_HTML =~ /alt="\[Bild!\]"/i
!ll&&!rl&&r
000
$_[0]->as_HTML =~ /ViewItem/ and not $_[0]->as_HTML =~ /thumbs\.ebay\./ and not $_[0]->as_HTML =~ /alt="\[Picture!\]"/i
!ll&&!rl&&r
000
$_[0]->as_HTML =~ /ViewItem/ and not $_[0]->as_HTML =~ /thumbs\.ebay\./
!ll&&!rl&&r
000
MC/DC0%0/4
$_[0]->as_HTML =~ /ViewItem/ and not $_[0]->as_HTML =~ /thumbs\.ebay\./ and not $_[0]->as_HTML =~ /alt="\[Picture!\]"/i and not $_[0]->as_HTML =~ /alt="\[Bild!\]"/i
$_[0]->as_HTML =~ /ViewItem/ not $_[0]->as_HTML =~ /thumbs\.ebay\./ not $_[0]->as_HTML =~ /alt="\[Picture!\]"/i not $_[0]->as_HTML =~ /alt="\[Bild!\]"/i
Truth table0%0/5
A and not(B) and not(C) and not(D)
A= $_[0]->as_HTML =~ /ViewItem/B= not $_[0]->as_HTML =~ /thumbs\.ebay\./C= not $_[0]->as_HTML =~ /alt="\[Picture!\]"/iD= not $_[0]->as_HTML =~ /alt="\[Bild!\]"/i
ABCDresult
0XXX0
10XX0
110X0
11100
11111
213 &&
214 # Ignore thumbnails:
215 ($_[0]->as_HTML !~ m!thumbs\.ebay\.! )
216 &&
217 # Ignore other images:
218 ($_[0]->as_HTML !~ m/alt="\[Picture!\]"/i )
219 &&
220 ($_[0]->as_HTML !~ m/alt="\[Bild!\]"/i )
221 &&
222 ($_[0]->as_HTML !~ m!alt="buyItNow"!i )
223 )
224 }
225 0 );
226 TD:
227 0 foreach my $oTD (@aoTD)
228 {
229 0 my $sTD = $oTD->as_HTML;
230 # First FONT tag contains the url & title:
231 0 my $oFONT = $oTD->look_down('_tag', 'font');
232 0 ▶ next TD unless ref $oFONT;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $oFONT 0 0 0
233 # First A tag contains the url & title:
234 0 my $oA = $oFONT->look_down('_tag', 'a');
235 0 ▶ next TD unless ref $oA;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $oA 0 0 0
236 0 my $sURL = $oA->attr('href');
237 0 ▶ next TD unless $sURL =~ m!ViewItem!;
Branch: 1 branch
BranchTrueFalseTotal
unless $sURL =~ /ViewItem/ 0 0 0
238 0 my $sTitle = $oA->as_text;
239 0 ▶ print STDERR " + TD ===$sTD===\n" if 1 < $self->{_debug};
Branch: 1 branch
BranchTrueFalseTotal
if 1 < $self->{"_debug"} 0 0 0
240 0 my ($iItemNum) = ($sURL =~ m!item=(\d+)!);
241 0 my ($iPrice, $iBids, $sDate) = ('$unknown', 'no', 'unknown');
242 # The rest of the info about this item is in sister TD elements to
243 # the right:
244 0 my @aoSibs = $oTD->right;
245 # The next sister has the current bid amount (or starting bid):
246 0 my $oTDprice = shift @aoSibs;
247 0 ▶ if (ref $oTDprice)
Branch: 1 branch
BranchTrueFalseTotal
if (ref $oTDprice) 0 0 0
248 {
249 0 ▶ if (1 < $self->{_debug})
Branch: 1 branch
BranchTrueFalseTotal
if (1 < $self->{"_debug"}) 0 0 0
250 {
251 0 my $s = $oTDprice->as_HTML;
252 0 print STDERR " + TDprice ===$s===\n";
253 } # if
254 0 $iPrice = $oTDprice->as_text;
255 0 $iPrice =~ s!(\d)$W*($currency$W*[\d.,]+)!$1 (Buy-It-Now for $2)!;
256 } # if
257 # The next sister has the number of bids:
258 0 my $oTDbids = shift @aoSibs;
259 0 ▶ if (ref $oTDbids)
Branch: 1 branch
BranchTrueFalseTotal
if (ref $oTDbids) 0 0 0
260 {
261 0 ▶ if (1 < $self->{_debug})
Branch: 1 branch
BranchTrueFalseTotal
if (1 < $self->{"_debug"}) 0 0 0
262 {
263 0 my $s = $oTDbids->as_HTML;
264 0 print STDERR " + TDbids ===$s===\n";
265 } # if
266 0 $iBids = $oTDbids->as_text;
267 } # if
268 # Bid listed as hyphen means no bids:
269 0 ▶ $iBids = 'no' if $iBids =~ m!\A$W*-$W*\Z!;
Branch: 1 branch
BranchTrueFalseTotal
if $iBids =~ /\A$W*-$W*\Z/ 0 0 0
270 # Bid listed as whitespace means no bids:
271 0 ▶ $iBids = 'no' if $iBids =~ m!\A$W*\Z!;
Branch: 1 branch
BranchTrueFalseTotal
if $iBids =~ /\A$W*\Z/ 0 0 0
272 0 my $sDesc = "Item \043$iItemNum; $iBids bid";
273 0 ▶ $sDesc .= 's' if $iBids ne '1';
Branch: 1 branch
BranchTrueFalseTotal
if $iBids ne 1 0 0 0
274 0 $sDesc .= '; ';
275 0 ▶ $sDesc .= 'no' ne $iBids ? 'current' : 'starting';
Branch: 1 branch
BranchTrueFalseTotal
'no' ne $iBids ? : 0 0 0
276 0 $sDesc .= " bid $iPrice";
277 # The last sister has the auction start date:
278 0 my $oTDdate = pop @aoSibs;
279 0 ▶ if (ref $oTDdate)
Branch: 1 branch
BranchTrueFalseTotal
if (ref $oTDdate) 0 0 0
280 {
281 0 my $s = $oTDdate->as_HTML;
282 0 ▶ print STDERR " + TDdate ===$s===\n" if 1 < $self->{_debug};
Branch: 1 branch
BranchTrueFalseTotal
if 1 < $self->{"_debug"} 0 0 0
283 0 $sDate = $oTDdate->as_text;
284 } # if
285 0 my $hit = new WWW::Search::Result;
286 0 $hit->add_url($sURL);
287 0 $hit->title($sTitle);
288 0 $hit->description($sDesc);
289 0 $hit->change_date($sDate);
290 0 $hit->raw($oTD->as_HTML); # This is new to this Backend
291 0 push(@{$self->{cache}}, $hit);
292 0 $self->{'_num_hits'}++;
293 0 $hits_found++;
294 # Delete this HTML element so that future searches go faster!
295 0 $oTD->detach;
296 0 $oTD->delete;
297 } # foreach
298  
299 # Look for a NEXT link:
300 0 my @aoA = $tree->look_down('_tag', 'a');
301 TRY_NEXT:
302 0 foreach my $oA (reverse @aoA)
303 {
304 0 ▶ next TRY_NEXT unless ref $oA;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $oA 0 0 0
305 0 ▶ print STDERR " + try NEXT A ===", $oA->as_HTML, "===\n" if 1 < $self->{_debug};
Branch: 1 branch
BranchTrueFalseTotal
if 1 < $self->{"_debug"} 0 0 0
306 0 my $href = $oA->attr('href');
307 0 ▶ next TRY_NEXT unless $href;
Branch: 1 branch
BranchTrueFalseTotal
unless $href 0 0 0
308 # If we get all the way to the item list, there must be no next
309 # button:
310 0 ▶ last TRY_NEXT if $href =~ m!ViewItem!;
Branch: 1 branch
BranchTrueFalseTotal
if $href =~ /ViewItem/ 0 0 0
311 0 ▶ if ($oA->as_text =~ m!$next_tag$W+(>|&gt;)!i)
Branch: 1 branch
BranchTrueFalseTotal
if ($oA->as_text =~ /$next_tag$W+(>|&gt;)/i) 0 0 0
312 {
313 0 $self->{_next_url} = $self->absurl(undef, $href);
314 0 ▶ print STDERR " + got NEXT A ===", $self->{_next_url}, "===\n" if 1 < $self->{_debug};
Branch: 1 branch
BranchTrueFalseTotal
if 1 < $self->{"_debug"} 0 0 0
315 0 last TRY_NEXT;
316 } # if
317 } # foreach
318  
319 # All done with this page.
320 0 $tree->delete;
321 0 return $hits_found;
322 } # parse_tree
323  
324 1 1;
325  
326 __END__
↑ Summary EbayUK.pm »