blib/lib/Switch/Plain.pm

filter: Statementstmt 85.7% 24 / 28 Branchbran 50.0% 1 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 80.0% 8 / 10 Podpod n/a totaltotal 76.7% 33 / 43 CC 5 SCAR 11.0
CC
5
Cov
78%
_port
6.2
unimport
2.0
__ANON__
2.0
CRAP 3.0
↑ Summary Plain.xs »
1 package Switch::Plain;
2  
3 4 ▶use v5.14.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 4 ▶use XSLoader;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 4 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
10 4 our $VERSION = '0.0501';
11 4 XSLoader::load;
12 }
13  
14 4 my %export = (
15 sswitch => FLAG_SSWITCH,
16 nswitch => FLAG_NSWITCH,
17 );
18  
19 4 ▶sub _port {
Subroutine _port: called CC=5 SCAR=18.2
20 4 my $op = shift;
21  
22 4 my $class = shift;
23  
24 4 my @todo;
25 4 for my $item (@_) {
26 0 ▶ push @todo, $export{$item} || croak qq{"$item" is not exported by the $class module};
Condition0%0/2
$export{$item} || croak(qq["$item" is not exported by the $class module])
l!l
00
MC/DC0%0/1
$export{$item} || croak(qq["$item" is not exported by the $class module])
$export{$item}
Truth table0%0/2
A
A= $export{$item}
Aresult
11
00
27 }
28 4 ▶ for my $item (@todo ? @todo : values %export) {
Branch: 1 branch
BranchTrueFalseTotal
@todo ? : 0 4 4
29 8 $op->(\$^H{+HINTK_FLAGS}, $item);
30 }
31 }
32  
33 4 ▶sub import {
Subroutine import: called CC=1 SCAR=0.0
34 4 ▶ _port sub { ${$_[0]} |= $_[1]; }, @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
35 }
36  
37 0 ▶sub unimport {
Subroutine unimport: not called CC=1 SCAR=6.9
38 0 ▶ _port sub { ${$_[0]} &= ~$_[1]; }, @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
39 }
40  
41 4 'ok'
42 __END__
↑ Summary Plain.xs »