blib/lib/Getopt/ArgParse/ActionAppend.pm untested

filter: Statementstmt 0.0% 0 / 24 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 36 SCAR 30.0
CC
4
Cov
0%
apply
20.0
BEGIN
2.0
BEGIN
2.0
CRAP 20.0
1 package Getopt::ArgParse::ActionAppend;
2  
3 use strict;
4 use warnings;
5 use Carp;
6  
7 use Getopt::ArgParse::Parser;
8  
9 sub apply {
10 my $self = shift;
11  
12 my ($spec, $namespace, $values) = @_;
13  
14 my $v = $namespace->get_attr( $spec->{dest} );
15  
16 if ($spec->{type} == Getopt::ArgParse::Parser::TYPE_PAIR) {
17 $v = {} unless defined $v;
18  
19 for my $pair (@$values) {
20 my ($key, $val) = %$pair;
21 $v->{$key} = $val;
22 }
23  
24 } else {
25 $v = [] unless defined $v;
26 push @$v, @$values;
27 }
28  
29 $namespace->set_attr( $spec->{dest}, $v );
30  
31 return '';
32 }
33  
34 1;
35  
36 =head1 AUTHOR
37  
38 Mytram <mytram2@gmail.com> (original author)
39  
40 =head1 COPYRIGHT AND LICENSE
41  
42 This software is Copyright (c) 2014 by Mytram.
43  
44 This is free software, licensed under:
45  
46 The Artistic License 2.0 (GPL Compatible)
47  
48 =cut
49  
50