| 1 | package Plient::Protocol; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 0 | ▶ | sub prefix { warn "needs subclass prefix"; '' } | ||||||||||||||||||||||||||
|
Subroutine
prefix: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 8 | 0 | ▶ | sub methods { warn "needs subclass methods"; '' } | ||||||||||||||||||||||||||
|
Subroutine
methods: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | sub support_method { | ||||||||||||||||||||||||||
|
Subroutine
support_method: called CC=9 SCAR=35.7
Pod
undocumented
| |||||||||||||||||||||||||||||
| 11 | # trans $args here to let handlers to decide to pass or not | ||||||||||||||||||||||||||||
| 12 | 1 | my ( $class, $method_name, $args ) = @_; | |||||||||||||||||||||||||||
| 13 | 1 | $method_name = lc $method_name; | |||||||||||||||||||||||||||
| 14 | 1 | ▶ | $args ||= {}; | ||||||||||||||||||||||||||
|
Condition50%1/2
$args ||= {}
MC/DC0%0/1
$args ||= {}
$args
Truth table50%1/2
A
A= $args
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 0 | ▶ | if ( ! $args->{check_only} && !grep { $method_name eq $_ } $class->methods ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$args->{"check_only"} or grep {$method_name eq $_;} $class->methods
MC/DC0%0/2
$args->{"check_only"} or grep {$method_name eq $_;} $class->methods
$args->{"check_only"}
grep {$method_name eq $_;} $class->methods
Truth table33%1/3
A or B
A= $args->{"check_only"}B= grep {$method_name eq $_;} $class->methods
| |||||||||||||||||||||||||||||
| 17 | 0 | warn "$method_name for $class is not officially supported yet"; | |||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 1 | ▶ | return $class->can($method_name) if $class->can($method_name); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 21 | 0 | my $handler_method_name = $class->prefix . "_$method_name"; | |||||||||||||||||||||||||||
| 22 | 0 | for my $handler ( Plient->handlers( $class->prefix ) ) { | |||||||||||||||||||||||||||
| 23 | 0 | ▶ | $handler->init if $handler->can('init'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 24 | 0 | ▶ | if ( my $method = | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 25 | $handler->support_method( $handler_method_name, $args ) ) | ||||||||||||||||||||||||||||
| 26 | { | ||||||||||||||||||||||||||||
| 27 | 0 | return $method; | |||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | warn "$handler_method_name is not supported in available handlers" | ||||||||||||||||||||||||||||
| 31 | 0 | ▶ | unless $args->{check_only}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 32 | 0 | return; | |||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 2 | 1; | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | __END__ | ||||||||||||||||||||||||||||