blib/lib/Tie/Hash/MultiValueOpts.pm

filter: Statementstmt 100% 24 / 24 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 100% 35 / 35 CC 3 SCAR 5.1
CC
3
Cov
100%
STORE
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.7
↑ Summary
1 # Prefer numeric version for backwards compatibility
2 2 ▶BEGIN { require 5.010_001 }; ## no critic ( RequireUseStrict, RequireUseWarnings )
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 package Tie::Hash::MultiValueOpts;
7  
8 2 $Tie::Hash::MultiValueOpts::VERSION = 'v1.0.4';
9  
10 2 ▶use Tie::Hash ();
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use parent -norequire, 'Tie::StdHash';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 4 ▶sub TIEHASH { my $class = shift; bless { @_ }, $class }
Subroutine TIEHASH: called CC=1 SCAR=0.0
14  
15 19 ▶sub STORE {
Subroutine STORE: called CC=3 SCAR=11.0
16 19 my ( $self, $key, $value ) = @_;
17  
18 19 ▶ if ( my $current_value = $self->{ $key } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $current_value = $self->{$key}) 7 12 19
19 7 ▶ if ( 'ARRAY' eq ref $current_value ) {
Branch: 1 branch
BranchTrueFalseTotal
if ("ARRAY" eq ref $current_value) 5 2 7
20 5 push @{ $current_value }, $value;
21 5 return $current_value
22 }
23 }
24 14 $self->SUPER::STORE( $key, $value )
25 }
26  
27 2 1
↑ Summary