Excuse.pm

filter: Statementstmt 31.2% 10 / 32 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 60.0% 3 / 5 Podpod 100% 2 / 2 totaltotal 23.8% 15 / 63 CC 11 SCAR 45.8
CC
11
Cov
19%
said
132.0
help
2.0
BEGIN
1.0
CRAP 97.1
« Nickometer.pm ↑ Summary Insult.pm »
1 package Bot::BasicBot::Pluggable::Module::Excuse;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Bot::BasicBot::Pluggable::Module;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use base qw(Bot::BasicBot::Pluggable::Module);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7  
8 0 ▶sub said {
Subroutine said: not called CC=11 SCAR=48.8
Pod documented
9 0 my ($self, $mess, $pri) = @_;
10  
11 0 my $body = $mess->{body};
12 0 my $who = $mess->{who};
13  
14 0 ▶ return unless ($pri == 2);
Branch: 1 branch
BranchTrueFalseTotal
unless $pri == 2 0 0 0
15  
16 0 my $person;
17 0 ▶ return unless $body =~ /^\s*(?:give\s+(.*)\s+an\s+excuse|excuse\s*(.*))\s*$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $body =~ /^\s*(?:give\s+(.*)\s+an\s+excuse|excuse\s*(.*))\s*$/ 0 0 0
18 0 ▶ if (defined $1 && $1 ne 'in') {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $1 and $1 ne "in") 0 0 0
Condition0%0/3
defined $1 and $1 ne "in"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $1 and $1 ne "in"
defined $1 $1 ne "in"
Truth table0%0/3
A and B
A= defined $1B= $1 ne "in"
ABresult
0X0
100
111
19 0 $person = $1;
20 }
21  
22
23 0 ▶ $person = $who if !defined $person || $person =~ /^\s*me\s*$/i;
Branch: 1 branch
BranchTrueFalseTotal
if not defined $person or $person =~ /^\s*me\s*$/i 0 0 0
Condition0%0/3
not defined $person or $person =~ /^\s*me\s*$/i
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $person or $person =~ /^\s*me\s*$/i
not defined $person $person =~ /^\s*me\s*$/i
Truth table0%0/3
not(A) or B
A= not defined $personB= $person =~ /^\s*me\s*$/i
ABresult
1X1
011
000
24  
25 0 my $pos = tell DATA;
26 0 my @excuses;
27 0 for (<DATA>) {
28 0 chomp;
29 0 ▶ next if /^\s*$/;
Branch: 1 branch
BranchTrueFalseTotal
if /^\s*$/ 0 0 0
30 0 push @excuses, $_;
31 }
32 0 seek DATA, $pos,0;
33 0 my $excuse = $excuses[rand(@excuses)];
34  
35 0 ▶ return "No luck getting an excuse, $who." unless defined $excuse;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $excuse 0 0 0
36  
37  
38 0 ▶ if ($person eq $who) {
Branch: 1 branch
BranchTrueFalseTotal
if ($person eq $who) { } 0 0 0
39 0 return "Your excuse is: $excuse";
40 } else {
41 0 return "${person}'s excuse is: $excuse";
42 }
43  
44  
45  
46  
47 }
48  
49 0 ▶sub help {
Subroutine help: not called CC=1 SCAR=6.9
Pod documented
50 0 return "Commands: 'give <someone> an excuse' or just 'excuse''";
51 }
52  
53 =head1 NAME
54  
55 Bot::BasicBot::Pluggable::Module::Excuse - get an excuse
56  
57  
58 =head1 IRC USAGE
59  
60 give <someone> an excuse
61  
62 or just
63
64 excuse
65  
66 =head1 AUTHOR
67  
68 Simon Wistow, <simon@thegestalt.org>
69  
70 based on code by Jeff Ballard <ballard@NOSPAMcs.wisc.edu>
71  
72 =head1 COPYRIGHT
73  
74 Copyright 2005, Simon Wistow
75  
76 Distributed under the same terms as Perl itself.
77  
78 =head1 SEE ALSO
79  
80 Jeff Ballard's excuse server - http://www.cs.wisc.edu/~ballard/bofh/
81  
82 The BOFH archives - http://bofh.ntk.net/Bastard.html
83  
84 =cut
85  
86 1 1;
87 __DATA__
« Nickometer.pm ↑ Summary Insult.pm »