line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Simple interface to the Delicious API |
2
|
|
|
|
|
|
|
package WWW::Delicious::Simple; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
34055
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
44
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
1312
|
use JSON; |
|
1
|
|
|
|
|
32864
|
|
|
1
|
|
|
|
|
6
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my $API_BASE = 'http://feeds.delicious.com/v2/json/urlinfo/data?url='; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub get_url_info { |
14
|
0
|
|
|
0
|
1
|
|
my ( $class, $args ) = @_; |
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
my $ua = LWP::UserAgent->new; |
17
|
0
|
|
|
|
|
|
$ua->timeout(10); |
18
|
0
|
|
|
|
|
|
$ua->env_proxy; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
my $response = $ua->get( $API_BASE . $args->{url} ); |
21
|
|
|
|
|
|
|
|
22
|
0
|
0
|
|
|
|
|
if ( $response->is_success ) { |
23
|
0
|
|
|
|
|
|
return decode_json $response->content; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
else { |
26
|
0
|
|
|
|
|
|
die $response->status_line; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
__END__ |