blib/lib/Bot/Cobalt/Plugin/Games/Magic8.pm untested

filter: Statementstmt 0.0% 0 / 19 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 31 CC 2 SCAR 12.0
CC
2
Cov
0%
execute
6.0
new
2.0
BEGIN
2.0
CRAP 3.3
1 package Bot::Cobalt::Plugin::Games::Magic8;
2 $Bot::Cobalt::Plugin::Games::Magic8::VERSION = '0.021003';
3 use v5.10;
4 use strict; use warnings;
5  
6 sub new { bless [], shift }
7  
8 sub execute {
9 my ($self, $msg) = @_;
10  
11 state $responses = [ <DATA> ];
12 my $selected = $responses->[rand @$responses];
13 chomp $selected;
14  
15 my $nick = ref $msg ? $msg->src_nick : '';
16 ($nick // '') . ': ' . $selected
17 }
18  
19 1;
20  
21 =pod
22  
23 =head1 NAME
24  
25 Bot::Cobalt::Plugin::Games::Magic8 - Ask the Magic 8-ball
26  
27 =head1 SYNOPSIS
28  
29 !magic8 Will today be a good day?
30  
31 =head1 DESCRIPTION
32  
33 Ask the magic 8-ball; it knows the answer to all the big questions in
34 life.
35  
36 =head1 AUTHOR
37  
38 Jon Portnoy <avenj@cobaltirc.org>
39  
40 =cut
41  
42 __DATA__