lib/Horris/Connection/Plugin/Echo.pm

filter: Statementstmt 47.0% 8 / 17 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 50.0% 1 / 2 Podpod 0.0% 0 / 1 totaltotal 29.0% 9 / 31 CC 5 SCAR 32.3
CC
5
Cov
31%
irc_privmsg
30.0
BEGIN
1.0
CRAP 25.2
« blib/lib/App/Horris/CLI/Command/me2day.pm ↑ Summary lib/Horris/Connection/Plugin/Twitter.pm »
1 package Horris::Connection::Plugin::Echo;
2 # ABSTRACT: Echo Plugin on Horris
3  
4  
5 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 extends 'Horris::Connection::Plugin';
7 1 with 'MooseX::Role::Pluggable::Plugin';
8  
9 1 has '+is_enable' => (
10 default => 0
11 );
12  
13 0 ▶sub irc_privmsg {
Subroutine irc_privmsg: not called CC=5 SCAR=34.0
Pod undocumented
14 0 my ($self, $message) = @_;
15 0 my $msg = $message->message;
16 0 my $botname = $self->connection->nickname;
17 0 my ($cmd) = $msg =~ m/^$botname\S*\s+(\w+)/;
18
19 0 ▶ if (defined $cmd and lc $cmd eq 'echo') {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $cmd and lc $cmd eq 'echo') { } 0 0 0
elsif ($self->is_enable) { } 0 0 0
Condition0%0/3
defined $cmd and lc $cmd eq "echo"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $cmd and lc $cmd eq "echo"
defined $cmd lc $cmd eq "echo"
Truth table0%0/3
A and B
A= defined $cmdB= lc $cmd eq "echo"
ABresult
0X0
100
111
20 0 $self->_switch;
21 0 ▶ $self->connection->irc_notice({
Branch: 1 branch
BranchTrueFalseTotal
$self->is_enable ? : 0 0 0
22 channel => $message->channel,
23 message => $self->is_enable ? '[echo] on' : '[echo] off'
24 });
25 } elsif ($self->is_enable) {
26 0 $self->connection->irc_privmsg({
27 channel => $message->channel,
28 message => $message->from->nickname . ': ' . $msg
29 });
30 }
31  
32 0 return $self->pass;
33 }
34  
35 1 __PACKAGE__->meta->make_immutable;
36  
37 1 1;
38  
39 __END__
« blib/lib/App/Horris/CLI/Command/me2day.pm ↑ Summary lib/Horris/Connection/Plugin/Twitter.pm »