blib/lib/Ref/Store/Feature/KeyTyped.pm

filter: Statementstmt 95.6% 44 / 46 Branchbran 50.0% 3 / 6 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 10 / 10 Podpod 0.0% 0 / 1 totaltotal 85.2% 58 / 68 CC 6 SCAR 7.2
CC
6
Cov
87%
get_kt_prefix
3.6
__ANON__
3.0
BEGIN
2.0
CRAP 2.1
« blib/lib/Ref/Store/Attribute.pm ↑ Summary blib/lib/Ref/Store/ThreadUtil.pm »
1 package Ref::Store::Feature::KeyTyped;
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 our $AUTOLOAD;
5 2 ▶use Log::Fu;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use Carp qw(confess);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Ref::Store::Common;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 $SIG{__DIE__} = \&confess;
11 2 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.0
12 2 foreach my $fname (qw(
13 store
14 fetch
15 purgeby
16 unlink
17 lexists
18 )) {
19 10 my $wrapname = $fname . "_kt";
20 {
21 2 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
22 10 ▶ *{$wrapname} = sub {
Subroutine __ANON__: called CC=3 SCAR=11.1
23 2 my @args = @_;
24 2 my $self = $args[0];
25 2 my ($ktarg) = splice(@args, 2, 1);
26 2 my $pfix = $self->get_kt_prefix($ktarg, "$fname: Can't find prefix ($ktarg)!");
27 2 my $orig = $args[1];
28 2 ▶ die "Must have defined key!" unless defined $orig;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $orig 0 2 2
29 2 ▶ if(!ref $orig) {
Branch: 1 branch
BranchTrueFalseTotal
if (not ref $orig) { } 2 0 2
30 2 $orig = $pfix . HR_PREFIX_DELIM . $orig;
31 2 $args[1] = $orig;
32 } else {
33 0 log_warn("Using keytypes with object key has no effect");
34 }
35 2 shift @args;
36 2 return $self->$fname(@args);
37 10 };
38 }
39 }
40 }
41  
42 2 ▶sub get_kt_prefix {
Subroutine get_kt_prefix: called CC=3 SCAR=12.7
Pod undocumented
43 2 my ($self,$kt,$do_die) = @_;
44 2 my $ret = $self->keytypes->{$kt};
45 2 ▶ if((!$ret) && $do_die) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $ret and $do_die) 0 2 2
Condition33%1/3
not $ret and $do_die
!ll&&!rl&&r
200
MC/DC0%0/2
not $ret and $do_die
not $ret $do_die
Truth table33%1/3
not(A) and B
A= not $retB= $do_die
ABresult
0X0
100
111
46 0 die $do_die;
47 }
48 2 return $ret;
49 }
50 2 1;
« blib/lib/Ref/Store/Attribute.pm ↑ Summary blib/lib/Ref/Store/ThreadUtil.pm »