Kavorka/TraitFor/Parameter/locked.pm

filter: Statementstmt 100% 42 / 42 Branchbran 75.0% 9 / 12 Conditioncond 66.6% 4 / 6 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 100% 8 / 8 Podpod n/a totaltotal 90.1% 64 / 71 CC 9 SCAR 14.3
CC
9
Cov
92%
__ANON__
7.4
__ANON__
3.0
BEGIN
1.0
CRAP 4.2
« Kavorka/TraitFor/Sub/fresh.pm ↑ Summary Kavorka/ReturnType.pm »
1 1 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package Kavorka::TraitFor::Parameter::locked;
6  
7 1 our $AUTHORITY = 'cpan:TOBYINK';
8 1 our $VERSION = '0.039';
9  
10 1 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use Hash::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Types::Standard qw(Dict);
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 around _injection_assignment => sub
16 4 ▶{
Subroutine __ANON__: called CC=3 SCAR=11.0
17 4 my $next = shift;
18 4 my $self = shift;
19 4 my ($sig, $var, $val) = @_;
20
21 4 my $str = $self->$next(@_);
22
23 4 ▶ state $_FIND_KEYS = sub {
Subroutine __ANON__: called CC=7 SCAR=20.1
24 4 ▶ return unless $_[0];
Branch: 1 branch
BranchTrueFalseTotal
unless $_[0] 2 2 4
25 my ($dict) = grep {
26 2 ▶ $_->is_parameterized
Condition66%4/6
$_->is_parameterized && $_->has_parent && $_->parent->strictly_equals(&Dict())
!ll&&!rl&&r
1202
$_->is_parameterized and $_->has_parent
!ll&&!rl&&r
1202
MC/DC33%1/3
$_->is_parameterized && $_->has_parent && $_->parent->strictly_equals(&Dict())
$_->is_parameterized $_->has_parent $_->parent->strictly_equals(&Dict())
Truth table50%2/4
A and B && C
A= $_->is_parameterizedB= $_->has_parentC= $_->parent->strictly_equals(&Dict())
ABCresult
0XX0
10X0
1100
1111
27 and $_->has_parent
28 and $_->parent->strictly_equals(Dict)
29 } $_[0], $_[0]->parents;
30 2 ▶ return unless $dict;
Branch: 1 branch
BranchTrueFalseTotal
unless $dict 0 2 2
31 2 ▶ return if ref($dict->parameters->[-1]) eq q(HASH);
Branch: 1 branch
BranchTrueFalseTotal
if ref $dict->parameters->[-1] eq "HASH" 0 2 2
32 2 my @keys = sort keys %{ +{ @{ $dict->parameters } } };
33 2 ▶ return unless @keys;
Branch: 1 branch
BranchTrueFalseTotal
unless @keys 0 2 2
34 2 \@keys;
35 4 };
36
37 4 my $legal_keys = $_FIND_KEYS->($self->type);
38 4 ▶ my $quoted_keys = $legal_keys ? join(q[,], q[], map B::perlstring($_), @$legal_keys) : '';
Branch: 1 branch
BranchTrueFalseTotal
$legal_keys ? : 2 2 4
39 4 ▶ my $ref_var = $self->sigil eq '$' ? $var : "\\$var";
Branch: 1 branch
BranchTrueFalseTotal
$self->sigil eq '$' ? : 3 1 4
40
41 4 $str .= "&Hash::Util::unlock_hash($ref_var);";
42 4 $str .= "&Hash::Util::lock_keys($ref_var $quoted_keys);";
43
44 4 return $str;
45 1 };
46  
47 1 1;
« Kavorka/TraitFor/Sub/fresh.pm ↑ Summary Kavorka/ReturnType.pm »