| 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
MC/DC0%0/1
$args->{'size'} || 100
$args->{'size'}
Truth table0%0/2
A
A= $args->{'size'}
| |||||||||||||
| 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
| |||||||||||||
| 19 | 0 | ▶ | die ref $@ eq 'Net::Twitter::Error' | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 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
| |||||||||||||
| 31 | 0 | $self->{twitter}->destroy_status($next->{id}); | |||||||||||
| 32 | 0 | return $next->{text}; | |||||||||||
| 33 | } | ||||||||||||
| 34 | |||||||||||||
| 35 | 1 | 1; | |||||||||||
| 36 | __END__ | ||||||||||||