Funcs.pm

filter: Statementstmt 25.6% 10 / 39 Branchbran 0.0% 0 / 18 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 3 / 5 Podpod 100% 2 / 2 totaltotal 23.4% 15 / 64 CC 10 SCAR 43.7
CC
10
Cov
18%
said
110.0
help
2.0
BEGIN
1.0
CRAP 78.9
« Status.pm ↑ Summary Convert.pm »
1 package Bot::BasicBot::Pluggable::Module::Funcs;
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=10 SCAR=47.0
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 ▶ if ($body =~ /^\s*(asci*|chr) (\d+)\s*$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($body =~ /^\s*(asci*|chr) (\d+)\s*$/) 0 0 0
17 0 my $res;
18 0 my $num = $2;
19 0 ▶ if ($num < 32) {
Branch: 1 branch
BranchTrueFalseTotal
if ($num < 32) { } 0 0 0
20 0 $num += 64;
21 0 $res = "^".chr($num);
22 } else {
23 0 $res = chr($2);
24 }
25 0 ▶ if ($num == 0) { $res = "NULL"; } ;
Branch: 1 branch
BranchTrueFalseTotal
if ($num == 0) 0 0 0
26 0 return "ascii $2 is $res";
27 }
28  
29 0 ▶ if ($body =~ /^\s*ord (.)\s*$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($body =~ /^\s*ord (.)\s*$/) 0 0 0
30 0 my $res = $1;
31 0 ▶ if (ord($res) < 32) {
Branch: 1 branch
BranchTrueFalseTotal
if (ord $res < 32) 0 0 0
32 0 $res = chr(ord($res) + 64);
33 0 ▶ if ($res eq chr(64)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($res eq '@') { } 0 0 0
34 0 $res = 'NULL';
35 } else {
36 0 $res = '^'.$res;
37 }
38 }
39 0 return "$res is ascii ".ord($1);
40 }
41  
42 0 ▶ if ($body =~ /^\s*crypt\s+(\S+)\s+(\S+)/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($body =~ /^\s*crypt\s+(\S+)\s+(\S+)/) 0 0 0
43 0 return crypt($1, $2);
44 }
45  
46 0 ▶ if ($body =~ /^rot13\s+(.*)/i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($body =~ /^rot13\s+(.*)/i) 0 0 0
47 # rot13 it
48 0 my $reply = $1;
49 0 $reply =~ y/A-Za-z/N-ZA-Mn-za-m/;
50 0 return $reply;
51 }
52  
53  
54  
55 }
56  
57 0 ▶sub help {
Subroutine help: not called CC=1 SCAR=6.9
Pod documented
58 0 return "Commands: '(chr|ascii) <number>', 'ord <char>', 'rot13 <string>', 'crypt <PLAINTEXT> <SALT>' ";
59 }
60  
61 1 1;
62  
63 __END__
« Status.pm ↑ Summary Convert.pm »