Agent/Twitter/Sink.pm untested

filter: Statementstmt 0.0% 0 / 18 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 2 Podpod n/a totaltotal 0.0% 0 / 22 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Exobrain::Agent::Twitter::Sink;
2 use Moose;
3 use Method::Signatures;
4  
5 our $VERSION = '1.04'; # VERSION
6 # ABSTRACT: Sink agent for exobrain/twitter
7  
8 with 'Exobrain::Agent::Twitter';
9 with 'Exobrain::Agent::Run';
10  
11 method run() {
12 # Start by initialising our twitter object, so we fail
13 # quickly if anything might go wrong there.
14  
15 $self->twitter;
16  
17 # Now watch for intents and process them.
18  
19 $self->exobrain->watch_loop(
20 class => 'Intent::Tweet',
21 then => sub {
22 my $event = shift;
23  
24 if (my $reply = $event->in_response_to) {
25 $self->twitter->update({
26 status => $event->tweet,
27 in_reply_to_status_id => $reply,
28 });
29 }
30 else {
31 $self->twitter->update($event->tweet);
32 }
33 },
34 );
35 }
36  
37 1;
38  
39 __END__