File Coverage

blib/lib/Tie/Hash/MultiValueOpts.pm
Criterion Covered Total %
statement 22 22 100.0
branch 4 4 100.0
condition n/a
subroutine 7 7 100.0
pod n/a
total 33 33 100.0


line stmt bran cond sub pod time code
1             # Prefer numeric version for backwards compatibility
2 2     2   270026 BEGIN { require 5.010_001 }; ## no critic ( RequireUseStrict, RequireUseWarnings )
3 2     2   13 use strict;
  2         5  
  2         104  
4 2     2   12 use warnings;
  2         4  
  2         266  
5              
6             package Tie::Hash::MultiValueOpts;
7              
8             $Tie::Hash::MultiValueOpts::VERSION = 'v1.0.4';
9              
10 2     2   1295 use Tie::Hash ();
  2         2392  
  2         86  
11 2     2   1006 use parent -norequire, 'Tie::StdHash';
  2         639  
  2         13  
12              
13 4     4   496765 sub TIEHASH { my $class = shift; bless { @_ }, $class }
  4         29  
14              
15             sub STORE {
16 19     19   11223 my ( $self, $key, $value ) = @_;
17              
18 19 100       78 if ( my $current_value = $self->{ $key } ) {
19 7 100       22 if ( 'ARRAY' eq ref $current_value ) {
20 5         12 push @{ $current_value }, $value;
  5         15  
21 5         22 return $current_value
22             }
23             }
24 14         72 $self->SUPER::STORE( $key, $value )
25             }
26              
27             1