Branch Coverage

blib/lib/Tk/Getopt.pm
Criterion Covered Total %
branch 69 432 15.9


line true false branch
39 0 10 if exists $a{'-options'}
41 3 7 if (exists $a{'-opttable'}) { }
7 0 elsif (exists $a{'-getopt'}) { }
48 1 6 if (ref $_ eq 'ARRAY' and defined $$_[3] and ref $$_[3] ne 'HASH')
51 0 1 if ((@$_ - 3) % 2 != 0)
58 0 7 if (ref $_ eq 'ARRAY' and $$_[0] =~ /\|/)
68 4 3 if (ref $a{'-getopt'} eq 'HASH') { }
77 2 5 if (ref $optionlist[0] eq 'HASH')
84 0 45 if $opt =~ /^($genprefix)+(.*)$/
86 0 45 unless ($opt =~ /^(\w+[-\w|]*)?(!|[=:][infse][\@%]?)?$/)
91 8 37 unless defined $c
93 1 44 if ($o =~ /\|/)
101 5 40 if (defined $$self{'options'} and not ref $optionlist[0]) { }
39 1 elsif (ref $optionlist[0]) { }
102 3 2 exists $$self{'options'}{$o} ? :
110 44 1 if (defined $varref)
111 2 42 if (ref $varref eq 'CODE')
114 1 1 if ($$self{'options'}{$o})
120 44 0 if (ref($varref) =~ /^(SCALAR|HASH|ARRAY)$/) { }
127 1 44 if (@aliases)
141 0 10 if %a
152 80 0 if ref $_ eq 'ARRAY' and $$_[0] ne ''
162 77 9 if ($$opt[3]{'var'}) { }
0 9 elsif ($$self{'options'}) { }
184 0 0 if defined $$opt[0] and $$opt[0] eq '' and defined $$opt[2]
192 0 0 if (defined $$opt[2])
194 0 0 if ($ref eq 'ARRAY') { }
0 0 elsif ($ref eq 'HASH') { }
0 0 elsif ($ref eq 'SCALAR') { }
209 0 1 unless $filename
210 0 1 unless $filename
211 0 1 if ($$self{'nosafe'}) { }
215 0 0 unless ($c->rdo($filename))
221 0 1 if ($@)
229 7 0 if (exists $$Tk::Getopt::loadoptions{$$opt[0]})
230 0 7 if (ref $self->varref($opt) eq 'CODE') { }
1 6 elsif (ref $self->varref($opt) eq 'ARRAY' and ref $$Tk::Getopt::loadoptions{$$opt[0]} eq 'ARRAY') { }
1 5 elsif (ref $self->varref($opt) eq 'HASH' and ref $$Tk::Getopt::loadoptions{$$opt[0]} eq 'HASH') { }
231 0 0 if $$Tk::Getopt::loadoptions{$$opt[0]}
248 0 1 unless $filename
249 0 1 unless $filename
251 0 1 if ($@) { }
255 1 0 if (open OPT, ">$filename") { }
259 11 0 unless ($$opt[3]{'nosave'})
261 0 11 if ($$opt[3]{'savevar'}) { }
266 9 2 if (ref $ref eq 'SCALAR') { }
2 0 elsif (ref($ref) =~ /^(HASH|ARRAY)$/) { }
275 1 0 if ('Data::Dumper'->can('Dumpxs')) { }
284 0 1 if $Tk::Getopt::DEBUG
309 0 9 if ($Tk::Getopt::x11_pass_through)
314 0 9 if ($Tk::Getopt::x11_pass_through)
317 0 0 if ($Tk::CmdLine::VERSION >= 3.012) { }
322 0 0 unless $Tk::CmdLine::Method{$sw}
323 0 0 if ($Tk::CmdLine::Method{$sw} ne 'Flag_')
333 0 0 unless $Tk::CmdLine::switch{$sw}
334 0 0 if ($Tk::CmdLine::switch{$sw} ne $flag_ref)
342 0 0 if $@
351 1 47 length $option == 1 && (!defined($type) || $type eq '' || $type eq '!') ? :
359 0 0 length $option == 1 ? :
372 0 0 $$opt[1] eq '!' ? :
376 0 0 if $$opt[3]{'help'}
377 0 0 if $$opt[2]
390 0 17 if ($fromgui)
393 17 0 unless ($callback)
396 2 15 if ($callback)
402 2 0 unless (defined $former and !exists($$former{$opt}) || ${$self->varref($optdef);} eq $$former{$opt})
409 0 17 if ($$optdef[3]{'strict'} and UNIVERSAL::isa($$optdef[3]{'choices'}, 'ARRAY'))
414 0 0 if defined $$optdef[2]
417 0 0 ref $choice eq 'ARRAY' ? :
418 0 0 if ($value eq $v)
423 0 0 unless ($seen)
424 0 0 if (defined $former) { }
441 0 0 if ($$self{'useerrordialog'} and defined &Tk::MainWindow::Existing)
443 0 0 if (Tk::Exists($mw))
448 0 0 if ($use_tk and not defined $is_safe)
451 0 0 unless defined $subroutine
452 0 0 if ($subroutine eq '(eval)')
459 0 0 if ($use_tk) { }
466 0 0 if ($@)
478 0 0 if ($Tk::VERSION < 804) { }
509 0 0 $$opt[1] =~ /f/ ? :
521 0 0 if (exists $$opt[3]{'range'}) { }
530 0 0 if (exists $$opt[3]{'range'}) { }
539 0 0 if ($$opt[3]{'strict'} and grep {ref $_ eq 'ARRAY';} @{$$opt[3]{'choices'};}) { }
550 0 0 if ($$opt[3]{'strict'})
556 0 0 if defined $$opt[2]
560 0 0 unless ($seen{$o})
578 0 0 if (defined $value)
581 0 0 if (ref $choice eq 'ARRAY' and $$choice[1] eq $value)
592 0 0 if (exists $$opt[3]{'choices'}) { }
595 0 0 defined $$opt[3]{'length'} ? :
600 0 0 if ($args{-'restrict'} or defined $$opt[3]{'maxsize'})
612 0 0 if $args{-'restrict'} ne '=i' || &$restrict_int($_[0]) and $args{-'restrict'} ne '=f' || &$restrict_float($_[0])
619 0 0 if $@
628 0 0 if ($top->can('chooseDirectory'))
632 0 0 if (eval { do { require Tk::DirSelect; 'Tk::DirSelect'->VERSION('1.03'); 1 } })
653 0 0 if ($^O ne 'MSWin32')
676 0 0 if Tk::Exists($t)
677 0 0 if ($ok == 1) { }
686 0 0 exists $args{'-subtype'} ? :
689 0 0 if (exists $$opt[3]{'choices'}) { }
693 0 0 if defined $$opt[2]
699 0 0 unless (eval qq[\n use Tk::PathEntry;\n my \$real_e;\n (\$e, \$real_e) = \$self->_fix_layout(\$topframe, "PathEntry",\n -textvariable => \$self->varref(\$opt));\n # XXX Escape is already used for cancelling Tk::Getopt\n \$real_e->bind("<\$_>" => sub { \$real_e->Finish }) for (qw/Return/);\n 1;\n ])
719 0 0 if ($Tk::VERSION >= 800) { }
720 0 0 if ($subtype eq 'dir') { }
0 0 elsif ($subtype eq 'savefile') { }
0 0 elsif ($subtype eq 'file') { }
732 0 0 if $subtype eq 'dir'
735 0 0 if ($@)
740 0 0 if ($fd eq 'FileDialog') { }
749 0 0 if ($act_val) { }
752 0 0 unless -d $dir
754 0 0 if ($fd =~ /^get(Open|Save)File$/) { }
0 0 elsif ($fd eq '_dir_select') { }
0 0 elsif ($fd eq 'FileDialog') { }
767 0 0 if ($subtype eq 'dir') { }
776 0 0 if ($fd =~ /^get(Open|Save)File$/) { }
0 0 elsif ($fd eq '_dir_select') { }
782 0 0 if ($subtype eq 'dir') { }
789 0 0 if (defined $file and $file ne '')
799 0 0 defined $$opt[3]{'length'} ? :
820 0 0 defined $$opt[3]{'length'} ? :
826 0 0 if ($frame->can('chooseColor'))
832 0 0 unless defined $color
843 0 0 defined $$opt[3]{'length'} ? :
849 0 0 if (eval { do { require Tk::Font; require Tk::FontDialog; 1 } })
855 0 0 unless defined $font
876 0 0 unless defined $current_page
881 0 0 if (ref $msglist and exists $$msglist{$current_top} and $$msglist{$current_top} ne '')
894 0 0 if (_is_separator($opt))
910 0 0 if (exists $$opt[3]{'label'}) { }
914 0 0 if ($label =~ /^(.*)-(.*)$/ and $1 eq $current_top)
920 0 0 if (exists $$opt[3]{'widget'}) { }
0 0 elsif (defined $$opt[1] and $$opt[1] eq '!' or $$opt[1] eq '') { }
0 0 elsif (defined $$opt[1] and $$opt[1] =~ /i/) { }
0 0 elsif (defined $$opt[1] and $$opt[1] =~ /f/) { }
0 0 elsif (defined $$opt[1] and $$opt[1] =~ /s/) { }
931 0 0 defined $$opt[3] && exists $$opt[3]{'subtype'} ? :
934 0 0 if ($subtype eq 'file' or $subtype eq 'savefile' or $subtype eq 'dir') { }
0 0 elsif ($subtype eq 'geometry') { }
0 0 elsif ($subtype eq 'color') { }
0 0 elsif ($subtype eq 'font') { }
950 0 0 if (defined $w)
953 0 0 if (exists $$opt[3]{'help'} and defined $balloon)
954 0 0 if defined $w
956 0 0 if defined $lw
959 0 0 if (exists $$opt[3]{'longhelp'})
984 0 0 if $$opt[3]{'nogui'}
985 0 0 if (exists $$undo_options{$$opt[0]})
987 0 0 if ($ref eq 'ARRAY') { }
0 0 elsif ($ref eq 'HASH') { }
0 0 elsif ($ref eq 'SCALAR') { }
1026 0 0 exists $a{'-delaypagecreate'} ? :
1031 0 0 if (exists $a{'-buttonpressed'}) { }
1032 0 0 if (ref $a{'-buttonpressed'} ne 'SCALAR')
1053 0 0 if exists $$string{$key}
1059 0 0 if (defined $page)
1067 0 0 if $$opt[3]{'nogui'}
1069 0 0 if ($ref eq 'ARRAY') { }
0 0 elsif ($ref eq 'HASH') { }
0 0 elsif ($ref eq 'SCALAR') { }
1084 0 0 if (ref $opt ne 'ARRAY')
1089 0 0 unless ($dont_use_notebook)
1091 0 0 if $@
1096 0 0 if $@
1100 0 0 if $@
1101 0 0 if $transient
1104 0 0 $dont_use_notebook ? :
1110 0 0 unless ($dont_use_balloon)
1111 0 0 if ($use_statusbar)
1114 0 0 $use_statusbar ? :
1122 0 0 if ($dont_use_notebook) { }
1125 0 0 unless $$opt[3]{'nogui'}
1133 0 0 if ref $opttable[0] eq 'ARRAY'
1138 0 0 if (ref $opt ne 'ARRAY') { }
0 0 elsif ($$opt[0] eq '' and not _is_separator($opt)) { }
1139 0 0 if (not $delay_page_create and $page_create_page)
1156 0 0 $delay_page_create ? :
1165 0 0 unless $$opt[3]{'nogui'}
1169 0 0 if (not $delay_page_create and $page_create_page)
1183 0 0 unless $$f{'Sw'}
1185 0 0 unless $nenner
1187 0 0 unless $rows and int $rows
1188 0 0 if ($rows / int($rows) > 0)
1195 0 0 if ($f->y + $f->height > $opt_editor->height)
1204 0 0 if ($buttons)
1205 0 0 if (ref $buttons ne 'ARRAY') { }
1212 0 0 if (not $buttons or $allowed_button{'ok'})
1218 0 0 unless ($dont_use_notebook)
1228 0 0 if ($allowed_button{'oksave'})
1237 0 0 unless ($dont_use_notebook)
1243 0 0 if ($err)
1253 0 0 if (not $buttons or $allowed_button{'apply'})
1264 0 0 if (not $buttons or $allowed_button{'cancel'})
1269 0 0 unless ($dont_use_notebook)
1279 0 0 if (not $buttons or $allowed_button{'undo'})
1289 0 0 if ($$self{'filename'})
1290 0 0 if (not $buttons or $allowed_button{'lastsaved'})
1302 0 0 if (not $nosave and !$buttons || $allowed_button{'save'})
1309 0 0 if ($@ =~ /No Data::Dumper/)
1319 0 0 if (not $buttons or $allowed_button{'defaults'})
1331 0 0 if $callback
1333 0 0 if (not $dont_use_notebook and defined $$self{'raised'})
1341 0 0 if (defined $statusbar)
1345 0 0 if ($opt_editor->can('Popup'))
1349 0 0 if ($wait)
1350 0 0 if ($pack)
1355 0 0 unless $opt_editor->ismapped
1366 0 0 unless $Tk::Getopt::CHECKMARK_ON
1371 0 0 unless $Tk::Getopt::CHECKMARK_OFF
1379 0 0 unless (defined $Tk::Getopt::FILE_IMAGE)
1382 0 0 unless $Tk::Getopt::FILE_IMAGE
1384 0 0 if ($Tk::Getopt::FILE_IMAGE) { }
1393 0 0 unless (defined $Tk::Getopt::CURR_GEOMETRY_IMAGE)
1396 0 0 unless $Tk::Getopt::CURR_GEOMETRY_IMAGE
1398 0 0 if ($Tk::Getopt::CURR_GEOMETRY_IMAGE) { }