Delicious.pm

filter: Statementstmt 66.6% 4 / 6 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 75.0% 6 / 8 CC 1 SCAR 1.4
CC
1
Cov
67%
BEGIN
1.3
BEGIN
1.0
CRAP 1.1
« D2H.pm ↑ Summary
1 package WebService::SyncSBS::Delicious;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 require Exporter;
5  
6 our @ISA = qw(Exporter);
7 our $VERSION = '0.02';
8  
9 0 ▶use Net::Delicious;
Subroutine BEGIN: called CC=1 SCAR=2.6
10  
11 sub new {
12 my $class = shift;
13 my $args = shift;
14  
15 my $self = bless {
16 user => $args->{user},
17 pass => $args->{pass},
18 recent_num => $args->{recent_num},
19 }, $class;
20  
21 $self->{obj} = Net::Delicious->new({user => $self->{user}, pswd => $self->{pass}, debug => 0});
22  
23 return $self;
24 }
25  
26 sub get_recent {
27 my $self = shift;
28  
29 my $ret = {};
30 foreach ($self->{obj}->recent_posts({count => $self->{recent_num}})) {
31 $ret->{$_->href} = {
32 url => $_->href,
33 title => $_->description,
34 description => $_->extended,
35 tags => $_->tags,
36 };
37  
38 utf8::decode($ret->{$_->href}->{url});
39 utf8::decode($ret->{$_->href}->{title});
40 utf8::decode($ret->{$_->href}->{description});
41 utf8::decode($ret->{$_->href}->{tags});
42  
43 }
44  
45 return $ret;
46 }
47  
48 sub add {
49 my $self = shift;
50 my $obj = shift;
51  
52 $self->{obj}->add_post({
53 url => $obj->{url},
54 description => $obj->{title},
55 extended => $obj->{description},
56 tags => $obj->{tags},
57 dt => $obj->{issued},
58 });
59 }
60  
61 sub delete {
62 my $self = shift;
63 }
64  
65 1;
66 __END__
« D2H.pm ↑ Summary