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)
261 5 103 if (length $option == 1) { }
278 14 94 if $option eq 'verbose' && $optspec->{$V_OPTSPEC} // '' eq $V_FOR_VERBOSE
281 57 51 if (@aliases > 0)
285 59 0 length $_ == 1 ? :
291 1 107 if ($spec->{'boolean'})
338 1 927 if defined $parsed->{'aliases'}{$alias}
362 2461 364 unless $spec->{$type}
433 0 1503 if $attrs{'garbage'}
455 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 '' ? :
480 0 143 if exists $option_aliases{$name}
524 167 10 unless defined $default_aliases->{$alias}
533 5 5 if ($user_optspecs->{$user_optspec} or 0)
535 4 1 if ($user_optspec ne $default_optspec)
546 0 6 if ($alias ne $default_name)
560 2 4 if ($alias eq 'verbose' and $default_optspecs->{$V_OPTSPEC} eq $V_FOR_VERBOSE)
572 154 5 if $user_options->{$optspec}{'desc'} or 0
586 166 0 unless defined $default_aliases->{$name}
594 64 0 unless (defined $user_aliases->{'help'})
602 64 0 unless (defined $user_aliases->{'rcfile'})
606 0 192 if (defined $user_aliases->{$option})
616 64 0 unless (defined $user_aliases->{'write-rcfile'})
618 0 64 if (defined $user_aliases->{'rcfile-format'})
649 1 60 if @_
650 1 59 if $self->get_initialized
655 0 59 unless $self->get_optspec or 0
677 49 0 if ($self->_get_default_optspec->{$V_OPTSPEC} eq $V_FOR_VERBOSE)
679 0 49 if (defined $options->{'v'})
696 2 47 if $options->{'version'}
699 2 45 if $options->{'manpage'}
702 10 35 if $options->{'write-rcfile'}
716 5 54 if ($options{'help'}) { }
4 50 elsif (not $opts_ok) { }
733 2 39 if (ref $options{$option} eq 'ARRAY') { }
2 37 elsif (ref $options{$option} eq 'HASH') { }
738 1 4 unless $csv->parse($value)
755 0 4 unless $csv->parse($value)
761 3 1 if $csv->fields == 1
774 0 3 if defined $hash->{$k}
787 10 39 if defined $options{'rcfile'}
811 26 23 if ($rcfile and -r $rcfile) { }
821 0 16 if ref $arg
822 16 0 if $arg =~ /Unable to recognise encoding/ms
823 0 0 if $arg =~ /ParserDetails[.]ini/msx
843 20 29 if (defined $raw_config->{'default'})
845 0 20 if (ref $raw_config->{'default'} ne 'HASH') { }
867 8 17 if (not ref $raw_config->{$key}) { }
901 78 45 if ref $value eq $type or $type eq 'NONE'
904 0 45 if ref $value
909 35 10 if ($type eq 'BOOLEAN' or $type eq 'FLAG')
911 18 17 $value // 0 ? :
915 0 10 if ($type eq 'COUNT')
919 0 0 unless $value =~ /^ \d+ $/msx
936 4 6 if $type eq 'ARRAY'
959 30 37 unless (exists $argref->{'options'})
967 1 61 if exists $argref->{'default_settings'}
976 29 33 exists $argref->{'rcfile'} ? :
982 2 60 if (exists $argref->{'write_rcfile'})
991 1 61 exists $argref->{'usage'} ? :
1013 1 1 unless $parser->content_seen
1048 1 11 unless $self->get_initialized
1052 3 8 unless $file
1058 7 1 if (ref $writer eq 'CODE') { }
1107 2 6 if (exists $write_rcfile_of{&ident($self)})
1122 0 6 $CLI::Startup::EVAL_ERROR ? :
1129 0 6 unless defined $writer->{$format}
1142 0 2 if $CLI::Startup::EVAL_ERROR
1155 8 4 unless ref $value
1161 2 2 if (ref $value eq 'ARRAY') { }
2 0 elsif (ref $value eq 'HASH') { }
1170 0 2 if ($types->{$setting} || '') ne 'ARRAY'
1181 0 2 if ($types->{$setting} || '') ne 'HASH'
1209 0 2 if $CLI::Startup::EVAL_ERROR
1212 0 2 unless open my $RCFILE, '>', $file
1214 0 2 unless print {$RCFILE;} XMLout($self->get_options_as_defaults)
1216 0 2 unless close $RCFILE
1229 0 2 if $CLI::Startup::EVAL_ERROR
1234 0 2 unless open my $RCFILE, '>', $file
1236 0 2 unless print {$RCFILE;} $json->encode($self->get_options_as_defaults)
1238 0 2 unless close $RCFILE
1251 0 2 if $CLI::Startup::EVAL_ERROR
1266 0 3 unless open my $RCFILE, '>', $file
1268 0 3 unless print {$RCFILE;} Dumper($self->get_options_as_defaults)
1270 0 3 unless close $RCFILE