Branch Coverage

blib/lib/CLI/Helpers.pm
Criterion Covered Total %
branch 87 214 40.6


line true false branch
57 1 2 if ($arg eq 'delay_argv') { }
0 2 elsif ($arg eq 'preprocess_argv') { }
0 2 elsif ($arg eq 'copy_argv') { }
73 0 1 if ($explicit_argv != 1)
85 0 1 if $_init_complete++
86 0 1 if $ARGV_AT_INIT
152 13 169 $def->{'aliases'} ? :
153 78 104 if ($def->{'format'}) { }
13 91 elsif ($def->{'incremental'}) { }
13 78 elsif ($def->{'reversible'}) { }
165 12 1 if (defined $opt_ref and is_arrayref($opt_ref)) { }
167 0 12 $COPY_ARGV ? :
170 0 1 $COPY_ARGV ? :
176 0 13 unless (eval {
189 0 0 unless open $DATA_HANDLE, ">", $data_file
191 0 0 unless (eval {
209 2 12 unless $argv
210 12 2 $argv ? :
211 0 14 if $opts->{'data-file'}
228 0 14 exists $opts->{'syslog-tag'} && length $opts->{'syslog-tag'} ? :
0 14 exists $opts->{'syslog-facility'} && length $opts->{'syslog-facility'} ? :
0 14 $opts->{'tags'} ? :
231 0 14 unless $DEF{'ENCODE'} eq "json" or $DEF{'ENCODE'} eq "yaml"
237 0 14 if ($DEF{'SYSLOG'})
241 0 0 unless (eval {
249 0 14 if ($DEF{'NOPASTE'})
253 0 0 unless (eval {
268 0 2 if (keys %TAGS)
275 0 2 if (@STICKY)
281 0 2 if (@NOPASTE)
286 0 0 $ENV{'NOPASTE_SERVICES'} ? :
0 0 $DEF{'NOPASTE_SERVICE'} ? :
293 0 0 $DEF{'NOPASTE_PUBLIC'} ? :
296 0 0 if ($services) { }
308 0 2 if $DEF{'SYSLOG'}
323 0 0 if ($def->{'aliases'})
326 0 0 length $alias > 1 ? :
331 0 0 if length $desc > $opt_width
333 0 0 if ($def->{'reversible'})
350 0 0 if (defined $color and $DEF{'COLOR'})
358 14 0 unless is_interactive()
364 0 0 if ($rc != 0)
369 0 0 if ($stdout =~ /auto/ or $stdout =~ /true/)
377 2 0 exists $DEF{$_[0]} ? :
384 0 23 unless @args
386 9 14 if (@args == 1)
390 14 0 if (is_hashref($args[0]))
393 23 1 if exists $_valid_opts{$k}
397 1 13 if $invalid
409 0 23 unless @lines
412 0 23 unless keys %DEF
415 0 8 $DEF{'ENCODE'} eq 'yaml' || $opts->{'yaml'} ? :
416 24 0 if defined $x
417 8 16 if (defined $_ and ref $_) { }
421 0 23 exists $opts->{'color'} && defined $opts->{'color'} ? :
424 0 23 exists $opts->{'indent'} ? :
427 0 0 if ($DEF{'TAGS'} and exists $opts->{'tag'})
431 0 0 unless $DEF{'TAGS'}{$opts->{'tag'}}
435 0 23 scalar(@input) % 2 == 0 && (exists $opts->{'kv'} && $opts->{'kv'} == 1) ? :
437 0 23 if ($DO_KV) { }
442 0 0 $DEF{'KV_FORMAT'} eq ': ' ? :
451 23 0 if (not $DEF{'QUIET'} or $opts->{'IMPORTANT'})
452 5 18 $opts->{'stderr'} ? :
454 2 21 if exists $opts->{'clear'}
460 0 23 if (defined $DATA_HANDLE and $opts->{'data'}) { }
0 46 elsif ($DEF{'SYSLOG'} and not $opts->{'no_syslog'}) { }
465 0 0 exists $opts->{'stderr'} ? :
0 0 exists $opts->{'syslog_level'} ? :
470 0 0 if $opts->{'data'}
479 0 0 unless (eval {
488 0 23 if (exists $opts->{'sticky'})
495 0 23 if ($DEF{'NOPASTE'})
502 5 5 is_hashref($_[0]) ? :
503 5 5 unless exists $opts->{'level'}
504 5 5 $opts->{'level'} > 1 ? :
508 0 10 unless keys %DEF
510 8 2 unless ($DEF{'DEBUG'})
511 5 3 unless $DEF{'VERBOSE'} >= $opts->{'level'}
518 15 19 is_hashref($_[0]) ? :
522 0 34 unless keys %DEF
525 28 6 unless $DEF{'DEBUG'}
528 3 3 exists $opts->{'_caller_package'} ? :
529 4 2 unless lc $DEF{'DEBUG_CLASS'} eq "all" or $package eq $DEF{'DEBUG_CLASS'}
547 1 14 if (is_hashref($_[0]) and defined $_[1] and is_ref($_[1]))
555 15 0 $DEF{'ENCODE'} eq 'json' || $opts->{'json'} ? :
563 0 0 unless exists $_allow_override{lc $var}
580 0 0 if defined $answer
593 0 0 $question =~ s/([^a-zA-Z0-9\)\]\}])\s*$// ? :
594 0 0 if (exists $args{'default'})
601 0 0 exists $args{'validate'} ? :
606 0 0 if defined $error
613 0 0 if (exists $args{'default'} and length $text == 0)
618 0 0 if ($validate->{$v}->() > 0)
635 0 0 if (is_arrayref($opts)) { }
0 0 elsif (is_hashref($opts)) { }
651 0 0 if defined $choice
666 0 0 if (my $validate = $args{'validate'})
672 0 0 if defined $_
683 0 0 if exists $args{'yn'}
684 0 0 if exists $args{'menu'}
686 0 0 if (lc($prompt) =~ /passw(or)?d/)
689 0 0 if defined $_
701 0 0 if ($interactive) { }
705 0 0 if $args->{'clear_line'}
706 0 0 if ($args->{'noecho'}) { }
718 0 0 if length $text and $text =~ /\S/
720 0 0 if $args->{'clear_line'}