Plient/Protocol.pm

filter: Statementstmt 53.5% 15 / 28 Branchbran 20.0% 2 / 10 Conditioncond 40.0% 2 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 66.6% 4 / 6 Podpod 0.0% 0 / 3 totaltotal 41.8% 23 / 55 CC 9 SCAR 31.5
CC
9
Cov
44%
support_method
35.6
prefix
2.0
methods
2.0
CRAP 23.4
« Plient/Handler/HTTPLite.pm ↑ Summary Plient/Test.pm »
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 ||= {}
l!l
10
MC/DC0%0/1
$args ||= {}
$args
Truth table50%1/2
A
A= $args
Aresult
11
00
15  
16 0 ▶ if ( ! $args->{check_only} && !grep { $method_name eq $_ } $class->methods ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($args->{"check_only"} or grep {$method_name eq $_;} $class->methods) 0 1 1
Condition33%1/3
$args->{"check_only"} or grep {$method_name eq $_;} $class->methods
l!l&&r!l&&!r
100
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
ABresult
1X1
011
000
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
BranchTrueFalseTotal
if $class->can($method_name) 1 0 1
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
BranchTrueFalseTotal
if $handler->can("init") 0 0 0
24 0 ▶ if ( my $method =
Branch: 1 branch
BranchTrueFalseTotal
if (my $method = $handler->support_method($handler_method_name, $args)) 0 0 0
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
BranchTrueFalseTotal
unless $args->{"check_only"} 0 0 0
32 0 return;
33 }
34  
35 2 1;
36  
37 __END__
« Plient/Handler/HTTPLite.pm ↑ Summary Plient/Test.pm »