Branch Coverage

blib/lib/CLI/Startup.pm
Criterion Covered Total %
branch 167 212 78.7


line true false branch
63 1 29 unless $self->get_initialized
74 2 3 unless defined $settings and ref $settings eq 'HASH'
76 1 2 if $self->get_initialized
89 1 22 unless $self->get_initialized
107 1 70 unless ref $spec eq 'HASH'
109 1 69 if $self->get_initialized
121 1 18 unless $self->get_initialized
131 1 69 if $self->get_initialized
144 1 63 if $self->get_initialized
157 1 6 if $self->get_initialized
159 1 5 if $writer and ref $writer ne 'CODE'
165 2 3 if ($writer) { }
222 0 14 unless keys %{$optspec;}
235 14 0 if $optspec->{$V_OPTSPEC} // '' eq $V_FOR_VERBOSE
241 2 12 if (defined $msg)
262 5 103 if (length $option == 1) { }
279 14 94 if $option eq 'verbose' && $optspec->{$V_OPTSPEC} // '' eq $V_FOR_VERBOSE
282 57 51 if (@aliases > 0)
286 59 0 length $_ == 1 ? :
292 1 107 if ($spec->{'boolean'})
339 1 927 if defined $parsed->{'aliases'}{$alias}
363 2395 355 unless $spec->{$type}
434 0 1448 if $attrs{'garbage'}
456 327 1121 $attrs{'argument'} eq '=' ? :
0 466 $attrs{'subtype'} eq 'n' ? :
982 466 $attrs{'subtype'} eq '' ? :
45 1403 $attrs{'type'} eq '@' ? :
49 1399 $attrs{'type'} eq '%' ? :
1354 94 !($attrs{'type'} =~ /[\@%]/msx) ? :
26 1422 $attrs{'type'} eq '!' ? :
144 1304 $attrs{'type'} eq '+' ? :
671 777 $attrs{'type'} eq '' && $attrs{'argument'} eq '' ? :
481 0 88 if exists $option_aliases{$name}
525 167 10 unless defined $default_aliases->{$alias}
534 5 5 if ($user_optspecs->{$user_optspec} or 0)
536 4 1 if ($user_optspec ne $default_optspec)
547 0 6 if ($alias ne $default_name)
561 2 4 if ($alias eq 'verbose' and $default_optspecs->{$V_OPTSPEC} eq $V_FOR_VERBOSE)
573 154 5 if $user_options->{$optspec}{'desc'} or 0
587 166 0 unless defined $default_aliases->{$name}
595 64 0 unless (defined $user_aliases->{'help'})
603 64 0 unless (defined $user_aliases->{'rcfile'})
607 0 192 if (defined $user_aliases->{$option})
617 64 0 unless (defined $user_aliases->{'write-rcfile'})
619 0 64 if (defined $user_aliases->{'rcfile-format'})
650 1 60 if @_
651 1 59 if $self->get_initialized
656 0 59 unless $self->get_optspec or 0
678 49 0 if ($self->_get_default_optspec->{$V_OPTSPEC} eq $V_FOR_VERBOSE)
680 0 49 if (defined $options->{'v'})
697 2 47 if $options->{'version'}
700 2 45 if $options->{'manpage'}
703 5 40 if $options->{'write-rcfile'}
717 5 54 if ($options{'help'}) { }
4 50 elsif (not $opts_ok) { }
734 2 24 if (ref $options{$option} eq 'ARRAY') { }
2 22 elsif (ref $options{$option} eq 'HASH') { }
739 1 4 unless $csv->parse($value)
756 0 4 unless $csv->parse($value)
762 3 1 if $csv->fields == 1
775 0 3 if defined $hash->{$k}
788 5 44 if defined $options{'rcfile'}
812 26 23 if ($rcfile and -r $rcfile) { }
822 0 18 if ref $arg
823 18 0 if $arg =~ /Unable to recognise encoding/ms
824 0 0 if $arg =~ /ParserDetails[.]ini/msx
844 20 29 if (defined $raw_config->{'default'})
846 0 20 if (ref $raw_config->{'default'} ne 'HASH') { }
868 8 17 if (not ref $raw_config->{$key}) { }
902 80 43 if ref $value eq $type or $type eq 'NONE'
905 0 43 if ref $value
910 35 8 if ($type eq 'BOOLEAN' or $type eq 'FLAG')
912 18 17 $value // 0 ? :
916 0 8 if ($type eq 'COUNT')
920 0 0 unless $value =~ /^ \d+ $/msx
937 3 5 if $type eq 'ARRAY'
960 30 37 unless (exists $argref->{'options'})
968 1 61 if exists $argref->{'default_settings'}
977 29 33 exists $argref->{'rcfile'} ? :
983 2 60 if (exists $argref->{'write_rcfile'})
992 1 61 exists $argref->{'usage'} ? :
1014 1 1 unless $parser->content_seen
1049 1 6 unless $self->get_initialized
1053 3 3 unless $file
1059 2 1 if (ref $writer eq 'CODE') { }
1108 2 1 if (exists $write_rcfile_of{&ident($self)})
1123 0 1 $CLI::Startup::EVAL_ERROR ? :
1130 0 1 unless defined $writer->{$format}
1143 0 1 if $CLI::Startup::EVAL_ERROR
1156 3 2 unless ref $value
1162 1 1 if (ref $value eq 'ARRAY') { }
1 0 elsif (ref $value eq 'HASH') { }
1171 0 1 if ($types->{$setting} || '') ne 'ARRAY'
1182 0 1 if ($types->{$setting} || '') ne 'HASH'
1210 0 1 if $CLI::Startup::EVAL_ERROR
1213 0 1 unless open my $RCFILE, '>', $file
1215 0 1 unless print {$RCFILE;} XMLout($self->get_options_as_defaults)
1217 0 1 unless close $RCFILE
1230 0 1 if $CLI::Startup::EVAL_ERROR
1235 0 1 unless open my $RCFILE, '>', $file
1237 0 1 unless print {$RCFILE;} $json->encode($self->get_options_as_defaults)
1239 0 1 unless close $RCFILE
1252 0 1 if $CLI::Startup::EVAL_ERROR
1267 0 2 unless open my $RCFILE, '>', $file
1269 0 2 unless print {$RCFILE;} Dumper($self->get_options_as_defaults)
1271 0 2 unless close $RCFILE