Branch Coverage

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


line true false branch
63 1 34 unless $self->get_initialized
74 2 3 unless defined $settings and ref $settings eq 'HASH'
76 1 2 if $self->get_initialized
89 1 27 unless $self->get_initialized
107 1 70 unless ref $spec eq 'HASH'
109 1 69 if $self->get_initialized
121 1 23 unless $self->get_initialized
131 1 74 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 2461 364 unless $spec->{$type}
434 0 1503 if $attrs{'garbage'}
456 338 1165 $attrs{'argument'} eq '=' ? :
0 483 $attrs{'subtype'} eq 'n' ? :
1020 483 $attrs{'subtype'} eq '' ? :
46 1457 $attrs{'type'} eq '@' ? :
50 1453 $attrs{'type'} eq '%' ? :
1407 96 !($attrs{'type'} =~ /[\@%]/msx) ? :
27 1476 $attrs{'type'} eq '!' ? :
150 1353 $attrs{'type'} eq '+' ? :
696 807 $attrs{'type'} eq '' && $attrs{'argument'} eq '' ? :
481 0 143 if exists $option_aliases{$name}
525 166 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 10 35 if $options->{'write-rcfile'}
717 5 54 if ($options{'help'}) { }
4 50 elsif (not $opts_ok) { }
734 2 39 if (ref $options{$option} eq 'ARRAY') { }
2 37 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 10 39 if defined $options{'rcfile'}
812 26 23 if ($rcfile and -r $rcfile) { }
822 0 16 if ref $arg
823 16 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 78 45 if ref $value eq $type or $type eq 'NONE'
905 0 45 if ref $value
910 35 10 if ($type eq 'BOOLEAN' or $type eq 'FLAG')
912 18 17 $value // 0 ? :
916 0 10 if ($type eq 'COUNT')
920 0 0 unless $value =~ /^ \d+ $/msx
937 4 6 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 11 unless $self->get_initialized
1053 3 8 unless $file
1059 7 1 if (ref $writer eq 'CODE') { }
1108 2 6 if (exists $write_rcfile_of{&ident($self)})
1123 0 6 $CLI::Startup::EVAL_ERROR ? :
1130 0 6 unless defined $writer->{$format}
1143 0 2 if $CLI::Startup::EVAL_ERROR
1156 8 4 unless ref $value
1162 2 2 if (ref $value eq 'ARRAY') { }
2 0 elsif (ref $value eq 'HASH') { }
1171 0 2 if ($types->{$setting} || '') ne 'ARRAY'
1182 0 2 if ($types->{$setting} || '') ne 'HASH'
1210 0 2 if $CLI::Startup::EVAL_ERROR
1213 0 2 unless open my $RCFILE, '>', $file
1215 0 2 unless print {$RCFILE;} XMLout($self->get_options_as_defaults)
1217 0 2 unless close $RCFILE
1230 0 2 if $CLI::Startup::EVAL_ERROR
1235 0 2 unless open my $RCFILE, '>', $file
1237 0 2 unless print {$RCFILE;} $json->encode($self->get_options_as_defaults)
1239 0 2 unless close $RCFILE
1252 0 2 if $CLI::Startup::EVAL_ERROR
1267 0 3 unless open my $RCFILE, '>', $file
1269 0 3 unless print {$RCFILE;} Dumper($self->get_options_as_defaults)
1271 0 3 unless close $RCFILE