blib/lib/Object/InterfaceType.pm

filter: Statementstmt 100% 33 / 33 Branchbran 90.0% 9 / 10 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 91.0% 51 / 56 CC 8 SCAR 11.9
CC
8
Cov
93%
interface_type
5.0
__ANON__
4.0
BEGIN
1.0
CRAP 3.3
↑ Summary
1 package Object::InterfaceType;
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use base 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 our @EXPORT = 'interface_type';
6 2 our $VERSION = '0.01';
7  
8 2 ▶use Scalar::Util 'blessed';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 6 ▶sub interface_type {
Subroutine interface_type: called CC=5 SCAR=16.1
Pod documented
11 6 my($typename, $methods) = @_;
12 6 my $caller = caller(0);
13 6 ▶ if (ref($typename) eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $typename eq "ARRAY") 3 3 6
14 3 $methods = $typename;
15 3 $typename = undef;
16 }
17 6 ▶ $methods = [] unless $methods && ref($methods) eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless $methods and ref $methods eq "ARRAY" 0 6 6
Condition33%1/3
$methods and ref $methods eq "ARRAY"
!ll&&!rl&&r
006
MC/DC0%0/2
$methods and ref $methods eq "ARRAY"
$methods ref $methods eq "ARRAY"
Truth table33%1/3
A and B
A= $methodsB= ref $methods eq "ARRAY"
ABresult
0X0
100
111
18  
19 22 ▶ my $code = sub {
Subroutine __ANON__: called CC=4 SCAR=13.9
20 22 my $class = blessed $_[0];
21 22 ▶ return unless $class;
Branch: 1 branch
BranchTrueFalseTotal
unless $class 4 18 22
22 18 ▶ $class->can($_) or return for @{ $methods };
Branch: 1 branch
BranchTrueFalseTotal
$class->can($_) or return 10 6 16
23 12 return 1;
24 6 };
25  
26 6 ▶ return $code unless defined $typename;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $typename 3 3 6
27 2 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
28 3 *{"$caller\::is_$typename"} = $code;
29 }
30  
31 2 1;
32 __END__
↑ Summary