lib/App/SocialSKK/Protocol.pm

filter: Statementstmt 60.0% 12 / 20 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 3 / 5 Podpod 0.0% 0 / 2 totaltotal 45.4% 15 / 33 CC 4 SCAR 18.5
CC
4
Cov
46%
dispatch
12.0
accept
6.0
BEGIN
1.0
CRAP 6.4
« lib/App/SocialSKK/Plugin/Wikipedia.pm ↑ Summary script/socialskk.pl »
1 package App::SocialSKK::Protocol;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use base qw(App::SocialSKK::Base);
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 my %dispatch_table = (
7 1 => 'on_get_candidates',
8 2 => 'on_get_version',
9 3 => 'on_get_serverinfo',
10 );
11  
12 1 __PACKAGE__->mk_accessors(values %dispatch_table);
13  
14 0 ▶sub accept {
Subroutine accept: not called CC=2 SCAR=17.9
Pod undocumented
15 0 my ($self, $input) = @_;
16 0 ▶ return if !defined $input;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $input 0 0 0
17 0 my ($code, $text) = $input =~ /^(\d)(.+)?\s*$/ismx;
18 0 $self->dispatch($code, $text);
19 }
20  
21 0 ▶sub dispatch {
Subroutine dispatch: not called CC=3 SCAR=24.8
Pod undocumented
22 0 my ($self, $code, $text) = @_;
23 0 ▶ return if !defined $code;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $code 0 0 0
24 0 ▶ my $method = $dispatch_table{$code} or return;
Branch: 1 branch
BranchTrueFalseTotal
my $method = $dispatch_table{$code} or return 0 0 0
25 0 $self->$method->($text);
26 }
27  
28 1 1;
« lib/App/SocialSKK/Plugin/Wikipedia.pm ↑ Summary script/socialskk.pl »