Deutschland.pm

filter: Statementstmt 83.3% 10 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 87.5% 14 / 16 CC 1 SCAR 0.7
CC
1
Cov
83%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
↑ Summary DE.pm »
1
2 =head1 NAME
3
4 WWW::Search::Yahoo::Deutschland - class for searching Yahoo! Deutschland (Germany)
5
6 =head1 SYNOPSIS
7
8 use WWW::Search;
9 my $oSearch = new WWW::Search('Yahoo::Deutschland');
10 my $sQuery = WWW::Search::escape_query("Perl OOP Freelancer");
11 $oSearch->native_query($sQuery);
12 while (my $oResult = $oSearch->next_result())
13 {
14 print $oResult->url, "\n";
15 } # while
16
17 =head1 DESCRIPTION
18
19 This class is a Yahoo! Deutschland (Germany) specialization of
20 L<WWW::Search>. It handles making and interpreting searches on Yahoo!
21 Deutschland (Germany) F<http://de.yahoo.com>.
22
23 This class exports no public interface; all interaction should
24 be done through L<WWW::Search> objects.
25
26 =head1 NOTES
27
28 =head1 SEE ALSO
29
30 To make new back-ends, see L<WWW::Search>.
31
32 =head1 BUGS
33
34 Please tell the maintainer if you find any!
35
36 =head1 TESTING
37
38 There are no tests defined for this module.
39
40 =head1 AUTHOR
41
42 C<WWW::Search::Yahoo::Deutschland> is maintained by Martin Thurn
43 (mthurn@cpan.org).
44
45 =head1 LEGALESE
46
47 THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
48 WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
49 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
50
51 =cut
52
53 package WWW::Search::Yahoo::Deutschland;
54
55 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
56 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
57
58 2 ▶use Data::Dumper; # for debugging only
Subroutine BEGIN: called CC=1 SCAR=0.0
59 0 ▶use WWW::Search::Yahoo;
Subroutine BEGIN: called CC=1 SCAR=2.6
60
61 use vars qw( @ISA $VERSION $MAINTAINER );
62 @ISA = qw( WWW::Search::Yahoo );
63
64 $VERSION = do { my @r = (q$Revision: 1.4 $ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r };
65 $MAINTAINER = 'Martin Thurn <mthurn@cpan.org>';
66
67 =head2 native_setup_search
68
69
70 See WWW::Search for documentation.
71
72 =cut
73
74 sub native_setup_search
75 {
76 my ($self, $sQuery, $rh) = @_;
77 # print STDERR " + in Deutschland::native_setup_search, rh is ", Dumper($rh);
78 $self->{'_options'} = {
79 'p' => $sQuery,
80 'y' => 'y', # german sites only
81 n => 100,
82 };
83 $rh->{'search_base_url'} = 'http://de.search.yahoo.com';
84 $rh->{'search_base_path'} = '/search/de';
85 # print STDERR " + Yahoo::Deutschland::native_setup_search() is calling SUPER::native_setup_search()...\n";
86 return $self->SUPER::native_setup_search($sQuery, $rh);
87 } # native_setup_search
88
89
90 sub _string_has_count
91 {
92 my $self = shift;
93 my $s = shift;
94 # print STDERR " DDD Deutschland::_string_has_count($s)?\n";
95 return $1 if ($s =~ m!\bvon\s+(?:(?:etwa|ungefähr)\s+)?([,.0-9]+)!i);
96 return -1;
97 } # _string_has_count
98
99 sub _a_is_next_link
100 {
101 my $self = shift;
102 my $oA = shift;
103 return 0 unless (ref $oA);
104 my $sID = $oA->attr('id') || '';
105 return 1 if ($sID eq 'pg-next');
106 my $s = $oA->as_text;
107 my $WS = q{[\t\r\n\240\ ]};
108 return ($s =~ m!\A$WS*weitere$WS+&gt;$WS*\z!i);
109 } # _a_is_next_link
110
111
112 1;
113
114 __END__
↑ Summary DE.pm »