File Coverage

blib/lib/WebService/Blekko/Pagestats.pm
Criterion Covered Total %
statement 37 39 94.8
branch n/a
condition n/a
subroutine 13 14 92.8
pod 9 11 81.8
total 59 64 92.1


line stmt bran cond sub pod time code
1             #
2              
3             package WebService::Blekko::Pagestats;
4              
5 3     3   20 use strict;
  3         7  
  3         107  
6 3     3   17 use warnings;
  3         8  
  3         97  
7 3     3   15 no warnings qw( uninitialized );
  3         6  
  3         1538  
8              
9             =head1 NAME
10              
11             WebService::Blekko::Pagestats -- results from WebService::Blekko::pagestats
12              
13             =head1 DESCRIPTION
14              
15             These results are similar to the information which drives the various buttons
16             in the blekko search engine results for every URL.
17              
18             =cut
19              
20             our $VERSION = '1.00';
21              
22             sub new
23             {
24 3     3 0 63 my $class = shift;
25 3         10 my $self = bless {}, $class;
26              
27 3         8 my ( $json, $error, $http_code ) = @_;
28              
29 3         13 $self->{http_code} = $http_code;
30 3         13 $self->{error} = $error;
31              
32 3         16 my $answer = WebService::Blekko::my_decode_json( $json ); # XXX needs eval?
33              
34 3         12 $self->{raw} = $answer;
35              
36 3         8 foreach my $f ( qw( host_inlinks host_rank adsense cached dup ip rss ) )
37             {
38 21         64 $self->{$f} = $answer->{$f};
39             }
40              
41 3         53 return $self;
42             }
43              
44             # accessors
45              
46             =head1 METHODS
47              
48             =head2 http_code
49              
50             =head2 error
51              
52             =head2 host_inlinks
53              
54             An approximate count of the number of incoming links to this host
55              
56             =head2 host_rank
57              
58             blekko's rank for the host
59              
60             =head2 adsense
61              
62             The adsense ID observed on this page,
63              
64             =head2 cached
65              
66             True if blekko has a cached copy of this page. Use a query of the
67             URL /cache to display the cache.
68              
69             =head2 dup
70              
71             True if we think there is duplicate info on the page.
72              
73             =head2 ip
74              
75             The IP address blekko crawled for this website. Can be used
76             to query blekko for all websites observed on this IP address.
77              
78             =head2 rss
79              
80             Set if we observe an rss feed on this URL.
81              
82             =cut
83              
84             sub http_code
85             {
86 6     6 1 13 my ( $self ) = @_;
87              
88 6         42 return $self->{http_code};
89             }
90              
91             sub error
92             {
93 3     3 1 33 my ( $self ) = @_;
94              
95 3         29 return $self->{error};
96             }
97              
98             sub host_inlinks
99             {
100 2     2 1 5 my ( $self ) = @_;
101              
102 2         10 return $self->{host_inlinks};
103             }
104              
105             sub host_rank
106             {
107 2     2 1 5 my ( $self ) = @_;
108              
109 2         11 return $self->{host_rank};
110             }
111              
112             sub adsense
113             {
114 2     2 1 6 my ( $self ) = @_;
115              
116 2         11 return $self->{adsense};
117             }
118              
119             sub cached
120             {
121 2     2 1 5 my ( $self ) = @_;
122              
123 2         14 return $self->{cached};
124             }
125              
126             sub dup
127             {
128 1     1 1 412 my ( $self ) = @_;
129              
130 1         5 return $self->{dup};
131             }
132              
133             sub ip
134             {
135 2     2 1 5 my ( $self ) = @_;
136              
137 2         16 return $self->{ip};
138             }
139              
140             sub rss
141             {
142 0     0 1 0 my ( $self ) = @_;
143              
144 0         0 return $self->{rss};
145             }
146              
147             sub raw
148             {
149 15     15 0 765 my ( $self ) = @_;
150              
151 15         36 return $self->{raw};
152             }
153              
154             1;
155