ArgParse/ActionAppend.pm

filter: Statementstmt 100% 25 / 25 Branchbran 100% 6 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 97.3% 36 / 37 CC 5 SCAR 11.7
CC
5
Cov
100%
apply
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.2
« ArgParse/Namespace.pm ↑ Summary ArgParse/ActionCount.pm »
1 package Getopt::ArgParse::ActionAppend;
2  
3 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 9 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 9 ▶use Getopt::ArgParse::Parser;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 33 ▶sub apply {
Subroutine apply: called CC=5 SCAR=16.1
Pod undocumented
10 33 my $self = shift;
11  
12 33 my ($spec, $namespace, $values) = @_;
13  
14 33 my $v = $namespace->get_attr( $spec->{dest} );
15  
16 33 ▶ if ($spec->{type} == Getopt::ArgParse::Parser::TYPE_PAIR) {
Branch: 1 branch
BranchTrueFalseTotal
if ($spec->{'type'} == 4) { } 6 27 33
17 6 ▶ $v = {} unless defined $v;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $v 4 2 6
18  
19 6 for my $pair (@$values) {
20 9 my ($key, $val) = %$pair;
21 9 $v->{$key} = $val;
22 }
23  
24 } else {
25 27 ▶ $v = [] unless defined $v;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $v 16 11 27
26 27 push @$v, @$values;
27 }
28  
29 33 $namespace->set_attr( $spec->{dest}, $v );
30  
31 33 return '';
32 }
33  
34 9 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  
« ArgParse/Namespace.pm ↑ Summary ArgParse/ActionCount.pm »