ChatBots/Role/WebPoller.pm

filter: Statementstmt 78.5% 33 / 42 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 9 / 12 Podpod 100% 1 / 1 totaltotal 78.1% 43 / 55 CC 1 SCAR 1.6
CC
1
Cov
79%
poll
2.0
__ANON__
2.0
__ANON__
1.1
CRAP 1.2
« ChatBots/Role/Sender.pm ↑ Summary ChatBots.pm »
1 package Bot::ChatBots::Role::WebPoller;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 { our $VERSION = '0.014'; }
5  
6 1 ▶use Ouch;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use IO::Socket::SSL ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Mojo::UserAgent;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Log::Any qw< $log >;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 with 'Bot::ChatBots::Role::Poller';
16  
17 0 ▶has ua => (is => 'ro', default => sub { return Mojo::UserAgent->new });
Subroutine __ANON__: not called CC=1 SCAR=1.2
18 1 has tx_args => (is => 'ro', required => 1);
19  
20 0 ▶sub poll {
Subroutine poll: not called CC=1 SCAR=6.9
Pod documented
21 0 my ($self, $on_data, $args) = @_;
22 0 my $ua = $self->ua;
23 0 my $tx = $ua->build_tx(@{$self->tx_args});
24 0 ▶ my $cb = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
25 0 my ($ua, $tx) = @_;
26 0 return $on_data->({tx => $tx, ua => $ua});
27 0 };
28 0 return $ua->start($tx, $cb);
29 }
30  
31 1 1;
« ChatBots/Role/Sender.pm ↑ Summary ChatBots.pm »