line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::Hatena::Exist; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
29744
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
35
|
|
5
|
1
|
|
|
1
|
|
5
|
use base qw( Class::ErrorHandler ); |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
814
|
|
6
|
1
|
|
|
1
|
|
1091
|
use URI::Fetch::SimpleCache; |
|
1
|
|
|
|
|
198844
|
|
|
1
|
|
|
|
|
32
|
|
7
|
1
|
|
|
1
|
|
424
|
use XML::Simple; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use Readonly; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Readonly our $HATENA_URL => q[http://d.hatena.ne.jp/exist?mode=xml&url=]; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
13
|
|
|
|
|
|
|
our $TARGET_URL; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
16
|
|
|
|
|
|
|
my($class,$self)=(shift,{@_}); |
17
|
|
|
|
|
|
|
bless($self,$class); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
$self->target_url( $self->{'url'} ) if $self->{'url'}; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
$self; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub target_url { |
25
|
|
|
|
|
|
|
my $self = shift; |
26
|
|
|
|
|
|
|
if(@_) { $TARGET_URL = shift } |
27
|
|
|
|
|
|
|
return $TARGET_URL; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub bookmark { |
31
|
|
|
|
|
|
|
shift->{'parse_ref'}->{'count'}->{'bookmark'}->{'content'}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub antenna { |
35
|
|
|
|
|
|
|
shift->{'parse_ref'}->{'count'}->{'antenna'}->{'content'}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub diary { |
39
|
|
|
|
|
|
|
shift->{'parse_ref'}->{'count'}->{'diary'}->{'content'}; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub parse_ref { |
43
|
|
|
|
|
|
|
shift->{'parse_ref'}; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub feed { |
47
|
|
|
|
|
|
|
shift->{'feed'}; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub get_feed { |
51
|
|
|
|
|
|
|
my $self = shift; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
my $get_url = $HATENA_URL.$self->target_url; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
my $res = URI::Fetch::SimpleCache->fetch( |
56
|
|
|
|
|
|
|
$get_url, |
57
|
|
|
|
|
|
|
Cache => $self->{'Cache'}, |
58
|
|
|
|
|
|
|
Cache_root => $self->{'Cache_root'}, |
59
|
|
|
|
|
|
|
Cache_default_expires => $self->{'Cache_default_expires'}, |
60
|
|
|
|
|
|
|
UserAgent => $self->{'ua'}, |
61
|
|
|
|
|
|
|
) or return $self->error( URI::Fetch::SimpleCache->errstr ); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
$self->{'feed'} = $res->content; |
64
|
|
|
|
|
|
|
$self->{'parse_ref'} = $self->parse_feed; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
$self->{'feed'}; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub parse_feed { |
70
|
|
|
|
|
|
|
XMLin(shift->{'feed'}); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |
74
|
|
|
|
|
|
|
__END__ |