ES.pm

filter: Statementstmt 57.8% 22 / 38 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 6 / 12 Podpod n/a totaltotal 56.0% 28 / 50 CC 1 SCAR 4.1
CC
1
Cov
58%
_result_count_element_specs_USE_DEFAULT
2.0
_result_count_pattern
2.0
_next_text
2.0
CRAP 1.5
« FR.pm ↑ Summary IT.pm »
1  
2 # $Id: ES.pm,v 2.104 2013-03-03 15:03:57 Martin Exp $
3  
4 =head1 NAME
5  
6 WWW::Search::Ebay::ES - backend for searching auctions at eBay Spain
7  
8 =head1 SYNOPSIS
9  
10 use WWW::Search;
11 my $oSearch = new WWW::Search('Ebay::ES');
12 my $sQuery = WWW::Search::escape_query("Yakface");
13 $oSearch->native_query($sQuery);
14 while (my $oResult = $oSearch->next_result())
15 { print $oResult->url, "\n"; }
16  
17 =head1 DESCRIPTION
18  
19 Acts just like WWW::Search::Ebay.
20  
21 =head1 AUTHOR
22  
23 Martin 'Kingpin' Thurn, C<mthurn at cpan.org>, L<http://tinyurl.com/nn67z>.
24  
25 =cut
26  
27 package WWW::Search::Ebay::ES;
28  
29 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
33 1 ▶use base 'WWW::Search::Ebay';
Subroutine BEGIN: called CC=1 SCAR=0.0
34 our
35 1 $VERSION = do { my @r = (q$Revision: 2.104 $ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r };
36  
37 sub _native_setup_search
38 2 ▶ {
Subroutine _native_setup_search: called CC=1 SCAR=0.0
39 2 my ($self, $native_query, $rhOptsArg) = @_;
40 2 $self->{search_host} = 'http://www.ebay.es';
41 2 return $self->SUPER::_native_setup_search($native_query, $rhOptsArg);
42 } # _native_setup_search
43  
44 # This is what we look_down for to find the HTML element that contains
45 # the result count:
46 sub _result_count_element_specs_USE_DEFAULT
47 0 ▶ {
Subroutine _result_count_element_specs_USE_DEFAULT: not called CC=1 SCAR=6.9
48 return (
49 0 '_tag' => 'div',
50 class => 'count'
51 );
52 } # _result_count_element_specs
53  
54  
55 sub _result_count_pattern
56 0 ▶ {
Subroutine _result_count_pattern: not called CC=1 SCAR=6.9
57 0 return qr'(?:encontrados?\s+)?(\d+)\s+(art(í|í)culo|resultado|anuncio)s?';
58 } # _result_count_pattern
59  
60  
61 sub _next_text
62 0 ▶ {
Subroutine _next_text: not called CC=1 SCAR=6.9
63 # The text of the "Next" button, localized:
64 0 return 'Siguiente';
65 } # _next_text
66  
67 sub _currency_pattern
68 1 ▶ {
Subroutine _currency_pattern: called CC=1 SCAR=0.0
69 1 my $self = shift;
70 # A pattern to match all possible currencies found in eBay listings
71 # (if one character looks weird, it's really a British Pound symbol
72 # but Emacs shows it wrong):
73 1 my $W = $self->whitespace_pattern;
74 1 return qr{[\d.,]+$W+EUR}; # } } # Emacs indentation bugfix
75 } # _currency_pattern
76  
77 sub _preprocess_results_page_OFF
78 0 ▶ {
Subroutine _preprocess_results_page_OFF: not called CC=1 SCAR=6.9
79 0 my $self = shift;
80 0 my $sPage = shift;
81 # print STDERR Dumper($self->{response});
82 # For debugging:
83 0 print STDERR $sPage;
84 0 exit 88;
85 } # _preprocess_results_page
86  
87 sub _columns
88 0 ▶ {
Subroutine _columns: not called CC=1 SCAR=6.9
89 0 my $self = shift;
90 # This is for ES:
91 0 return qw( paypal bids price shipping enddate );
92 } # _columns
93  
94 sub _process_date_abbrevs
95 0 ▶ {
Subroutine _process_date_abbrevs: not called CC=1 SCAR=6.9
96 0 my $self = shift;
97 0 my $s = shift;
98 0 $s =~ s!Tiempo\s+restante:!!gi;
99 # Convert Spanish abbreviations for units of time to something
100 # Date::Manip can parse (namely, English words):
101 0 $s =~ s!(\d)d!$1 days!;
102 0 $s =~ s!(\d)h!$1 hours!;
103 0 $s =~ s!(\d)m!$1 minutes!;
104 0 return $s;
105 } # _process_date_abbrevs
106  
107  
108 1 1;
109  
110 __END__
« FR.pm ↑ Summary IT.pm »