blib/lib/Twitter/Queue.pm

filter: Statementstmt 44.0% 11 / 25 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 50.0% 3 / 6 Podpod 100% 3 / 3 totaltotal 39.5% 17 / 43 CC 5 SCAR 18.4
CC
5
Cov
33%
add
12.0
new
6.0
next
6.0
CRAP 6.3
↑ Summary
1 package Twitter::Queue;
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Net::Twitter::Lite::WithAPIv1_1;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 our $VERSION = 0.02;
6  
7 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
8 0 my ($class, $args) = @_;
9 return bless {
10 twitter => Net::Twitter::Lite::WithAPIv1_1->new(%$args),
11 0 ▶ size => $args->{size} || 100,
Condition0%0/2
$args->{'size'} || 100
l!l
00
MC/DC0%0/1
$args->{'size'} || 100
$args->{'size'}
Truth table0%0/2
A
A= $args->{'size'}
Aresult
11
00
12 }, $class;
13 }
14  
15 0 ▶sub add {
Subroutine add: not called CC=3 SCAR=24.8
Pod documented
16 0 my ($self, $data) = @_;
17 0 my $res = eval { $self->{twitter}->update($data) };
18 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
19 0 ▶ die ref $@ eq 'Net::Twitter::Error'
Branch: 1 branch
BranchTrueFalseTotal
ref $@ eq 'Net::Twitter::Error' ? : 0 0 0
20 ? sprintf 'Error tweeting %s %s %s', $@->code, $@->message, $@->error
21 : sprintf 'Error tweeting %s', $@;
22 }
23 0 return $res;
24 }
25  
26 0 ▶sub next {
Subroutine next: not called CC=2 SCAR=17.9
Pod documented
27 0 my ($self) = @_;
28 0 my $statuses = $self->{twitter}->home_timeline({ count => $self->{size} });
29 0 my $next = $statuses->[-1];
30 0 ▶ return undef unless $next;
Branch: 1 branch
BranchTrueFalseTotal
unless $next 0 0 0
31 0 $self->{twitter}->destroy_status($next->{id});
32 0 return $next->{text};
33 }
34  
35 1 1;
36 __END__
↑ Summary