Spell.pm

filter: Statementstmt 43.3% 13 / 30 Branchbran 0.0% 0 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 4 / 6 Podpod 100% 2 / 2 totaltotal 35.1% 19 / 54 CC 9 SCAR 38.3
CC
9
Cov
28%
said
70.9
help
2.0
BEGIN
1.0
CRAP 46.0
« Translate.pm ↑ Summary Stockquote.pm »
1 package Bot::BasicBot::Pluggable::Module::Spell;
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=9 SCAR=42.6
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 0 ▶ return unless $body =~ s/^spell(ing)?\s+(?:of |for )?\s+//i;
Branch: 1 branch
BranchTrueFalseTotal
unless $body =~ s/^spell(ing)?\s+(?:of |for )?\s+//i 0 0 0
16  
17 # h-h-h-hack
18 1 ▶ use Lingua::Ispell qw( :all );
Subroutine BEGIN: called CC=1 SCAR=0.0
19 0 Lingua::Ispell::allow_compounds(1);
20  
21 0 my ($r) = spellcheck($body);
22  
23 0 ▶ return "$body is probably spelt correctly" unless $r;
Branch: 1 branch
BranchTrueFalseTotal
unless $r 0 0 0
24  
25  
26 0 ▶ return "$1 is spelt correctly" if ($r->{type} eq 'ok');
Branch: 1 branch
BranchTrueFalseTotal
if $r->{"type"} eq "ok" 0 0 0
27 0 ▶ return "$1 can be formed from the root ".$r->{'root'} if ($r->{type} eq 'root');
Branch: 1 branch
BranchTrueFalseTotal
if $r->{"type"} eq "root" 0 0 0
28 0 ▶ return "$1 is a valid compund word" if ($r->{'type'} eq 'compound' );
Branch: 1 branch
BranchTrueFalseTotal
if $r->{"type"} eq "compound" 0 0 0
29 0 ▶ return "Near misses: ".join(", ",@{$r->{'misses'}}) if ($r->{'type'} eq 'miss' );
Branch: 1 branch
BranchTrueFalseTotal
if $r->{"type"} eq "miss" 0 0 0
30 0 ▶ return "Suggestions: ".join(", ", @{$r->{'guesses'}}) if ($r->{type} eq 'guess');
Branch: 1 branch
BranchTrueFalseTotal
if $r->{"type"} eq "guess" 0 0 0
31  
32 0 return "I have no idea, sorry";
33 }
34  
35 0 ▶sub help {
Subroutine help: not called CC=1 SCAR=6.9
Pod documented
36 0 return "Commands: 'spell <word>'";
37 }
38  
39 1 1;
40  
41 __END__
« Translate.pm ↑ Summary Stockquote.pm »