blib/lib/POE/Component/IRC/Plugin/Bollocks.pm

filter: Statementstmt 65.0% 26 / 40 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 88.8% 8 / 9 Podpod 25.0% 1 / 4 totaltotal 61.4% 35 / 57 CC 4 SCAR 13.7
CC
4
Cov
59%
S_public
12.0
new
2.0
BEGIN
1.0
CRAP 3.9
↑ Summary
1 package POE::Component::IRC::Plugin::Bollocks;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use Dev::Bollocks;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use POE::Component::IRC::Plugin qw(:ALL);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 3 $VERSION = '1.00';
10  
11 3 my @phrases = (
12 "So, let's ", 'We can ', 'We should ', 'Our mission is to ',
13 'Our job is to ', 'Your job is to ', 'And next we ', 'We better ',
14 'All of us plan to ', 'It is important to ', 'We were told to ',
15 'Our mission is to ', 'According to our plan we ');
16  
17 sub new {
18 1 ▶ my $package = shift;
Subroutine new: called CC=2 SCAR=6.9
Pod documented
19 1 my %args = @_;
20 1 $args{lc $_} = delete $args{$_} for keys %args;
21 1 bless \%args, $package;
22 }
23  
24 sub PCI_register {
25 1 ▶ my ($self,$irc) = @_;
Subroutine PCI_register: called CC=1 SCAR=0.0
Pod undocumented
26 1 $irc->plugin_register( $self, 'SERVER', qw(public) );
27 1 return 1;
28 }
29  
30 sub PCI_unregister {
31 1 ▶ return 1;
Subroutine PCI_unregister: called CC=1 SCAR=0.0
Pod undocumented
32 }
33  
34 sub S_public {
35 0 ▶ my ($self,$irc) = splice @_, 0, 2;
Subroutine S_public: not called CC=3 SCAR=24.8
Pod undocumented
36 0 my ($nick,$userhost) = ( split /!/, ${ $_[0] } )[0..1];
37 0 my $channel = ${ $_[1] }->[0];
38 0 my $what = ${ $_[2] };
39 0 my $mynick = $irc->nick_name();
40 0 my ($command) = $what =~ m/^\s*\Q$mynick\E[\:\,\;\.]?\s*(.*)$/i;
41 0 ▶ return PCI_EAT_NONE unless $command;
Branch: 1 branch
BranchTrueFalseTotal
unless $command 0 0 0
42 0 my @cmd = split /\s+/, $command;
43 0 ▶ return PCI_EAT_NONE unless uc( $cmd[0] ) eq 'BOLLOCKS';
Branch: 1 branch
BranchTrueFalseTotal
unless uc $cmd[0] eq "BOLLOCKS" 0 0 0
44 0 $irc->yield( privmsg =>
45 $channel =>
46 $phrases[int(rand(scalar @phrases))] . Dev::Bollocks->rand( int(rand(3) + 3)) );
47 0 return PCI_EAT_NONE;
48 }
49  
50 3 1;
51 __END__
↑ Summary