Branch Coverage

lib/App/MtAws/ConfigEngine.pm
Criterion Covered Total %
branch 262 276 94.9


line true false branch
50 8762 22184 unless defined $format
51 3 30943 if defined $App::MtAws::ConfigEngine::context->{'messages'}{$message} and not $App::MtAws::ConfigEngine::context->{'messages'}{$message}{'allow_redefine'}
91 394 425 if (my($format, $name) = $match =~ /^([\w]+)\s+([\w]+)$/) { }
92 295 99 if (lc $format eq 'option') { }
24 75 elsif (lc $format eq 'command') { }
93 1 294 unless defined(my $value = $data{$name})
96 0 24 unless defined(my $value = $data{$name})
99 1 74 unless defined(my $value = $data{$name})
103 1 424 unless defined(my $value = $data{$match})
108 549 1 if %data
116 1031 417 unless defined $err
118 532 21 if (ref $_ eq ref {}) { }
120 0 532 unless $self->{'messages'}{$name} and my $format = $self->{'messages'}{$name}{'format'}
131 828 2062 defined $ref && @$ref > 0 ? :
147 3 2667 unless defined $decoded
156 1 1832 unless defined $decoded
163 212 1224 unless defined $name
166 5 1219 if (defined $config and defined $config->{$name})
168 0 5 unless $new_enc_obj
173 7 1217 if (defined $new_encoding and defined $new_encoding->{'value'})
175 0 7 unless $new_enc_obj
185 5022 201 if ($self->{'options'}{$name}) { }
200 1 elsif (defined $self->{'optaliasmap'}{$name}) { }
199 8 734 if @ARGV and $ARGV[0] =~ /\b(help|h)\b/i
202 5 729 if @ARGV and $ARGV[0] =~ /^\-?\-?version$/i
215 7941 14201 defined $_->{'type'} ? :
216 18481 3661 unless $type eq ''
217 22127 15 unless $_->{'alias'}
20912 1230 unless $_->{'deprecated'}
220 6 723 unless &GetOptions(@getopts)
225 723 6 unless ($self->{'errors'})
226 614 109 if (defined(my $cmd_enc = $self->{'CmdEncoding'}))
227 614 0 if (my $cmd_ref = $self->{'options'}{$cmd_enc})
228 1 613 unless $cmd_ref->{'binary'}
232 614 108 if (defined(my $cfg_enc = $self->{'ConfigEncoding'}))
233 614 0 if (my $cfg_ref = $self->{'options'}{$cfg_enc})
234 1 613 unless $cfg_ref->{'binary'}
238 631 90 if (defined $self->{'ConfigOption'} and $cfg_opt = $self->{'options'}{$self->{'ConfigOption'}})
239 1 630 unless $cfg_opt->{'binary'}
241 613 17 if defined $cfg_value
242 17 613 unless defined $cfg_value
243 614 16 if (defined $cfg_value)
245 1 612 unless defined $cfg
251 5 713 defined $cmd_encoding ? :
252 5 713 defined $cfg_encoding ? :
257 718 6 unless ($self->{'errors'})
260 0 3325 unless $optref
262 180 3145 if $is_alias and $self->{'deprecated_options'}{$_->{'name'}}
268 6 5 $optref->{'original_option'} lt $_->{'name'} ? :
11 39 if defined $optref->{'value'} and not $optref->{'list'} and $optref->{'source'} eq 'option'
271 655 2670 if ($optref->{'binary'}) { }
275 3 2667 unless defined $decoded
278 165 3157 if ($optref->{'list'}) { }
279 39 126 if (defined $optref->{'value'}) { }
293 704 20 unless ($self->{'errors'})
295 701 3 if (defined $command) { }
298 3 4 unless $self->{'commands'}{$command} or defined($command = $self->{'aliasmap'}{$command}) and $self->{'commands'}{$command}
299 2 699 if $self->{'deprecated_commands'}{$original_command}
301 3 0 unless defined $command
305 698 26 unless ($self->{'errors'})
306 611 87 if (defined $cfg)
309 1897 1 if ($optref) { }
310 2 1895 if ($optref->{'list'}) { }
1837 58 elsif (not defined $optref->{'value'}) { }
314 4 1833 $optref->{'binary'} ? :
315 1 1836 unless defined $decoded
324 694 30 unless ($self->{'errors'})
328 6205 16282 if not defined $_->{'value'} and defined $_->{'default'}
331 603 91 if $self->{'preinitialize'}
338 1 2073 if $self->{$_} and not $self->{'options'}{$self->{$_}}{'seen'}
342 11 11852 if defined $_->{'value'} and $_->{'source'} eq 'option' and not $_->{'seen'}
345 432 259 unless ($self->{'errors'})
346 11 421 if (@ARGV)
347 1 10 unless (defined eval { do { &error('unexpected_argument', 'a', &decode($self->{'cmd_encoding'}, shift @ARGV, &Encode::DIE_ON_ERR() | &Encode::LEAVE_SRC())); 1 } })
355 421 270 unless ($self->{'errors'})
371 300 421 $self->{'errors'} ? :
380 6193 7440 if ($v->{'seen'} and defined $v->{'value'})
382 5995 198 unless $v->{'scope'}
392 1 23221 unless $App::MtAws::ConfigEngine::context->{'options'}{$_}
396 4 20798 if $App::MtAws::ConfigEngine::context->{'options'}{$name}
397 16346 4452 if (%opts)
399 28 16318 if (defined $opts{'alias'})
400 21 7 if ref $opts{'alias'} eq ref ''
403 1266 15080 if (defined $opts{'deprecated'})
404 636 630 if ref $opts{'deprecated'} eq ref ''
407 16318 28 unless $opts{'alias'}
15080 1266 unless $opts{'deprecated'}
408 2 1928 if defined $App::MtAws::ConfigEngine::context->{'options'}{$_}
409 8 1920 if defined $App::MtAws::ConfigEngine::context->{'optaliasmap'}{$_}
413 15076 1260 unless $opts{'deprecated'}
415 20788 0 unless $App::MtAws::ConfigEngine::context->{'options'}{$name}
426 2 2599 if $App::MtAws::ConfigEngine::context->{'options'}{$_}
436 2 18721 unless defined $App::MtAws::ConfigEngine::context->{'options'}{$name}
438 15720 3001 unless $App::MtAws::ConfigEngine::context->{'override_validations'} and exists $App::MtAws::ConfigEngine::context->{'override_validations'}{$name}
446 1 6377 if defined $App::MtAws::ConfigEngine::context->{'commands'}{$name}
447 1 6376 if defined $App::MtAws::ConfigEngine::context->{'aliasmap'}{$name}
448 26 6350 if (%opts)
449 9 17 if defined $opts{'alias'} and ref $opts{'alias'} eq ref ''
451 9 17 if defined $opts{'deprecated'} and ref $opts{'deprecated'} eq ref ''
453 11 15 unless $opts{'alias'}
14 12 unless $opts{'deprecated'}
454 2 33 if defined $App::MtAws::ConfigEngine::context->{'commands'}{$_}
455 9 24 if defined $App::MtAws::ConfigEngine::context->{'aliasmap'}{$_}
459 10 5 unless $opts{'deprecated'}
468 164 94 defined $opt->{'original_option'} ? :
473 295 26027 @_ ? :
474 1 26321 unless my $option = $App::MtAws::ConfigEngine::context->{'options'}{$o}
475 13148 13173 unless ($option->{'seen'})
477 58 13090 if ($option->{'positional'})
479 44 14 if (defined $v)
481 1 43 unless (defined eval { do { @{$option;}{'value', 'source'} = (&decode(scalar($App::MtAws::ConfigEngine::context->{'cmd_encoding'} || 'UTF-8'), $v, &Encode::DIE_ON_ERR() | &Encode::LEAVE_SRC()), 'positional') } })
495 8118 7632 unless ($opt->{'seen'})
498 2 8116 if $opt->{'positional'} and ($App::MtAws::ConfigEngine::context->{'positional_level'} ||= 'mandatory') ne 'mandatory'
499 76 8040 unless (defined $opt->{'value'})
501 2 1 unless $App::MtAws::ConfigEngine::context->{'positional_backlog'}
3 73 $opt->{'positional'} ? :
513 14 4616 if $App::MtAws::ConfigEngine::context->{'options'}{$_}{'positional'}
523 1 97 if $opt->{'positional'}
524 23 74 if (defined $opt->{'value'})
525 19 4 if $opt->{'source'} eq 'option'
535 10034 3156 if (defined $opt->{'value'} and not $opt->{'validated'})
542 155 7314 unless $v->{'cb'}->()
562 3014 1225 @_ ? :
570 226 0 @_ ? :
578 1 114 unless $App::MtAws::ConfigEngine::context->{'options'}{$name}{'validated'}
586 1 1487 unless defined $App::MtAws::ConfigEngine::context->{'options'}{$name}{'value'}
611 0 0 unless defined $App::MtAws::ConfigEngine::context->{'options'}{$name}{'value'}
618 1 429 if $App::MtAws::ConfigEngine::context->{'options'}{$name}
628 2 178 %data ? :
203 180 defined $App::MtAws::ConfigEngine::context->{'messages'}{$name} ? :
638 0 3 %data ? :
201 3 defined $App::MtAws::ConfigEngine::context->{'messages'}{$name} ? :
647 3 155 unless -f $filename
650 0 155 unless open my $F, '<:crlf', $filename
659 19 247 if /^\s*$/
660 8 239 if /^\s*\#/
663 145 94 if (($name, $value) = /^[ \t]*([A-Za-z0-9][A-Za-z0-9-]*)[ \t]*=[ \t]*(.*?)[ \t]*$/) { }
40 54 elsif (($name) = /^[ \t]*([A-Za-z0-9][A-Za-z0-9-]*)[ \t]*$/) { }