Plugin/Magic8Ball.pm

filter: Statementstmt 70.5% 12 / 17 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 3 / 6 Podpod n/a totaltotal 65.2% 15 / 23 CC 1 SCAR 4.1
CC
1
Cov
71%
_make_default_args
2.0
_make_response_message
2.0
_message_into_response_event
2.0
CRAP 1.5
« Plugin/Fortune.pm ↑ Summary Plugin/CoinFlip.pm »
1 package POE::Component::IRC::Plugin::Magic8Ball;
2  
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $VERSION = '1.001003'; # VERSION
7  
8 1 ▶use base 'POE::Component::IRC::Plugin::BaseWrap';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 my @Responses = (
11 q|Signs point to yes.|,
12 q|Yes.|,
13 q|Reply hazy, try again.|,
14 q|Without a doubt.|,
15 q|My sources say no.|,
16 q|As I see it, yes.|,
17 q|You may rely on it.|,
18 q|Concentrate and ask again.|,
19 q|Outlook not so good.|,
20 q|It is decidedly so.|,
21 q|Better not tell you now.|,
22 q|Very doubtful.|,
23 q|Yes - definitely.|,
24 q|It is certain.|,
25 q|Cannot predict now.|,
26 q|Most likely.|,
27 q|Ask again later.|,
28 q|My reply is no.|,
29 q|Outlook good.|,
30 q|Don't count on it.|,
31 );
32  
33 0 ▶sub _make_default_args {
Subroutine _make_default_args: not called CC=1 SCAR=6.9
34 return (
35 0 trigger => qr/^8\s*ball\s+(?=\S)/i,
36 response_event => 'irc_magic_8_ball',
37 );
38 }
39  
40 0 ▶sub _make_response_message {
Subroutine _make_response_message: not called CC=1 SCAR=6.9
41 0 my ( $self, $in_ref ) = @_;
42 0 my $nick = (split /!/, $in_ref->{who})[0];
43 return [
44 0 "$nick, " . $Responses[rand @Responses]
45 ];
46 }
47  
48 0 ▶sub _message_into_response_event { 'response' }
Subroutine _message_into_response_event: not called CC=1 SCAR=6.9
49  
50  
51 1 1;
52 __END__
« Plugin/Fortune.pm ↑ Summary Plugin/CoinFlip.pm »