| 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
| |||||||||||||||||||||||||||||||||||
| 25 | my ($dict) = grep { | ||||||||||||||||||||||||||||||||||
| 26 | 2 | ▶ | $_->is_parameterized | ||||||||||||||||||||||||||||||||
|
Condition66%4/6
$_->is_parameterized && $_->has_parent && $_->parent->strictly_equals(&Dict())
$_->is_parameterized and $_->has_parent
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())
| |||||||||||||||||||||||||||||||||||
| 27 | and $_->has_parent | ||||||||||||||||||||||||||||||||||
| 28 | and $_->parent->strictly_equals(Dict) | ||||||||||||||||||||||||||||||||||
| 29 | } $_[0], $_[0]->parents; | ||||||||||||||||||||||||||||||||||
| 30 | 2 | ▶ | return unless $dict; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 31 | 2 | ▶ | return if ref($dict->parameters->[-1]) eq q(HASH); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 32 | 2 | my @keys = sort keys %{ +{ @{ $dict->parameters } } }; | |||||||||||||||||||||||||||||||||
| 33 | 2 | ▶ | return unless @keys; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||
| 39 | 4 | ▶ | my $ref_var = $self->sigil eq '$' ? $var : "\\$var"; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 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; | |||||||||||||||||||||||||||||||||