| 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
| |||||||||||
| 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
| |||||||||||
| 24 | 0 | ▶ | my $method = $dispatch_table{$code} or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 0 | $self->$method->($text); | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 1 | 1; | |||||||||