Branch Coverage

blib/lib/Tk/Getopt.pm
Criterion Covered Total %
branch 71 436 16.2


line true false branch
38 0 10 if exists $a{'-options'}
40 3 7 if (exists $a{'-opttable'}) { }
7 0 elsif (exists $a{'-getopt'}) { }
47 1 6 if (ref $_ eq 'ARRAY' and defined $_->[3] and ref $_->[3] ne 'HASH')
50 0 1 if ((@$_ - 3) % 2 != 0)
57 0 7 if (ref $_ eq 'ARRAY' and $_->[0] =~ /\|/)
67 4 3 if (ref $a{'-getopt'} eq 'HASH') { }
76 2 5 if (ref $optionlist[0] eq 'HASH')
83 0 45 if $opt =~ /^($genprefix)+(.*)$/
85 0 45 unless ($opt =~ /^(\w+[-\w|]*)?(!|[=:][infse][\@%]?)?$/)
90 8 37 unless defined $c
92 1 44 if ($o =~ /\|/)
100 5 40 if (defined $self->{'options'} and not ref $optionlist[0]) { }
39 1 elsif (ref $optionlist[0]) { }
103 3 2 exists $self->{'options'}{$o} ? :
109 44 1 if (defined $varref)
110 2 42 if (ref $varref eq 'CODE')
113 1 1 if ($self->{'options'}{$o})
119 44 0 if (ref($varref) =~ /^(SCALAR|HASH|ARRAY)$/) { }
126 1 44 if (@aliases)
140 0 10 if %a
151 80 0 if ref $_ eq 'ARRAY' and $_->[0] ne ''
161 77 9 if ($opt->[3]{'var'}) { }
0 9 elsif ($self->{'options'}) { }
183 0 0 if defined $opt->[0] and $opt->[0] eq '' and defined $opt->[2]
191 0 0 if (defined $opt->[2])
193 0 0 if ($ref eq 'ARRAY') { }
0 0 elsif ($ref eq 'HASH') { }
0 0 elsif ($ref eq 'SCALAR') { }
208 0 1 unless $filename
209 0 1 unless $filename
211 0 1 unless (-e $filename)
215 1 0 unless ('File::Spec'->file_name_is_absolute($filename))
219 0 1 if ($self->{'nosafe'}) { }
223 0 0 unless ($c->rdo($filename))
229 0 1 if ($@)
237 7 0 if (exists $$Tk::Getopt::loadoptions{$opt->[0]})
238 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') { }
239 0 0 if $$Tk::Getopt::loadoptions{$opt->[0]}
256 0 1 unless $filename
257 0 1 unless $filename
259 0 1 if ($@) { }
263 1 0 if (open OPT, ">$filename") { }
267 11 0 unless ($opt->[3]{'nosave'})
269 0 11 if ($opt->[3]{'savevar'}) { }
274 9 2 if (ref $ref eq 'SCALAR') { }
2 0 elsif (ref($ref) =~ /^(HASH|ARRAY)$/) { }
283 1 0 if ('Data::Dumper'->can('Dumpxs')) { }
292 0 1 if $Tk::Getopt::DEBUG
317 0 9 if ($Tk::Getopt::x11_pass_through)
322 0 9 if ($Tk::Getopt::x11_pass_through)
325 0 0 if ($Tk::CmdLine::VERSION >= 3.012) { }
330 0 0 unless $Tk::CmdLine::Method{$sw}
331 0 0 if ($Tk::CmdLine::Method{$sw} ne 'Flag_')
341 0 0 unless $Tk::CmdLine::switch{$sw}
342 0 0 if ($Tk::CmdLine::switch{$sw} ne $flag_ref)
350 0 0 if $@
359 1 47 length $option == 1 && (!defined($type) || $type eq '' || $type eq '!') ? :
367 0 0 length $option == 1 ? :
381 0 0 $opt->[1] eq '!' ? :
384 0 0 if $opt->[3]{'help'}
385 0 0 if $opt->[2]
398 0 17 if ($fromgui)
401 17 0 unless ($callback)
404 2 15 if ($callback)
410 2 0 unless (defined $former and !exists $former->{$opt} || ${$self->varref($optdef);} eq $former->{$opt})
417 0 17 if ($optdef->[3]{'strict'} and UNIVERSAL::isa($optdef->[3]{'choices'}, 'ARRAY'))
422 0 0 if defined $optdef->[2]
425 0 0 ref $choice eq 'ARRAY' ? :
426 0 0 if ($value eq $v)
431 0 0 unless ($seen)
432 0 0 if (defined $former) { }
449 0 0 if ($self->{'useerrordialog'} and defined &Tk::MainWindow::Existing)
451 0 0 if (Tk::Exists($mw))
456 0 0 if ($use_tk and not defined $is_safe)
459 0 0 unless defined $subroutine
460 0 0 if ($subroutine eq '(eval)')
467 0 0 if ($use_tk) { }
474 0 0 if ($@)
486 0 0 if ($Tk::VERSION < 804) { }
520 0 0 $opt->[1] =~ /f/ ? :
529 0 0 if (exists $opt->[3]{'range'}) { }
538 0 0 if (exists $opt->[3]{'range'}) { }
547 0 0 if ($opt->[3]{'strict'} and grep {ref $_ eq 'ARRAY';} @{$$opt[3]{'choices'};}) { }
558 0 0 if ($opt->[3]{'strict'})
564 0 0 if defined $opt->[2]
568 0 0 unless ($seen{$o})
586 0 0 if (defined $value)
589 0 0 if (ref $choice eq 'ARRAY' and $choice->[1] eq $value)
600 0 0 if (exists $opt->[3]{'choices'}) { }
606 0 0 defined $opt->[3]{'length'} ? :
608 0 0 if ($args{-'restrict'} or defined $opt->[3]{'maxsize'})
624 0 0 if $args{-'restrict'} ne '=i' || &$restrict_int($_[0]) and $args{-'restrict'} ne '=f' || &$restrict_float($_[0])
627 0 0 if $@
636 0 0 if ($top->can('chooseDirectory'))
640 0 0 if (eval { do { require Tk::DirSelect; 'Tk::DirSelect'->VERSION('1.03'); 1 } })
661 0 0 if ($^O ne 'MSWin32')
684 0 0 if Tk::Exists($t)
685 0 0 if ($ok == 1) { }
694 0 0 exists $args{'-subtype'} ? :
697 0 0 if (exists $opt->[3]{'choices'}) { }
701 0 0 if defined $opt->[2]
707 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 ])
727 0 0 if ($Tk::VERSION >= 800) { }
728 0 0 if ($subtype eq 'dir') { }
0 0 elsif ($subtype eq 'savefile') { }
0 0 elsif ($subtype eq 'file') { }
740 0 0 if $subtype eq 'dir'
743 0 0 if ($@)
748 0 0 if ($fd eq 'FileDialog') { }
757 0 0 if ($act_val) { }
760 0 0 unless -d $dir
762 0 0 if ($fd =~ /^get(Open|Save)File$/) { }
0 0 elsif ($fd eq '_dir_select') { }
0 0 elsif ($fd eq 'FileDialog') { }
775 0 0 if ($subtype eq 'dir') { }
784 0 0 if ($fd =~ /^get(Open|Save)File$/) { }
0 0 elsif ($fd eq '_dir_select') { }
790 0 0 if ($subtype eq 'dir') { }
797 0 0 if (defined $file and $file ne '')
811 0 0 defined $opt->[3]{'length'} ? :
832 0 0 defined $opt->[3]{'length'} ? :
834 0 0 if ($frame->can('chooseColor'))
840 0 0 unless defined $color
855 0 0 defined $opt->[3]{'length'} ? :
857 0 0 if (eval { do { require Tk::Font; require Tk::FontDialog; 1 } })
863 0 0 unless defined $font
884 0 0 unless defined $current_page
889 0 0 if (ref $msglist and exists $msglist->{$current_top} and $msglist->{$current_top} ne '')
902 0 0 if (_is_separator($opt))
918 0 0 if (exists $opt->[3]{'label'}) { }
922 0 0 if ($label =~ /^(.*)-(.*)$/ and $1 eq $current_top)
928 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/) { }
941 0 0 defined $opt->[3] && exists $opt->[3]{'subtype'} ? :
942 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') { }
958 0 0 if (defined $w)
961 0 0 if (exists $opt->[3]{'help'} and defined $balloon)
962 0 0 if defined $w
964 0 0 if defined $lw
967 0 0 if (exists $opt->[3]{'longhelp'})
992 0 0 if $opt->[3]{'nogui'}
993 0 0 if (exists $$undo_options{$opt->[0]})
995 0 0 if ($ref eq 'ARRAY') { }
0 0 elsif ($ref eq 'HASH') { }
0 0 elsif ($ref eq 'SCALAR') { }
1035 0 0 exists $a{'-delaypagecreate'} ? :
1039 0 0 if (exists $a{'-buttonpressed'}) { }
1040 0 0 if (ref $a{'-buttonpressed'} ne 'SCALAR')
1061 0 0 if exists $string->{$key}
1067 0 0 if (defined $page)
1075 0 0 if $opt->[3]{'nogui'}
1077 0 0 if ($ref eq 'ARRAY') { }
0 0 elsif ($ref eq 'HASH') { }
0 0 elsif ($ref eq 'SCALAR') { }
1092 0 0 if (ref $opt ne 'ARRAY')
1097 0 0 unless ($dont_use_notebook)
1099 0 0 if $@
1104 0 0 if $@
1108 0 0 if $@
1109 0 0 if $transient
1112 0 0 $dont_use_notebook ? :
1118 0 0 unless ($dont_use_balloon)
1119 0 0 if ($use_statusbar)
1122 0 0 $use_statusbar ? :
1130 0 0 if ($dont_use_notebook) { }
1134 0 0 unless $opt->[3]{'nogui'}
1141 0 0 if ref $opttable[0] eq 'ARRAY'
1146 0 0 if (ref $opt ne 'ARRAY') { }
0 0 elsif ($opt->[0] eq '' and not _is_separator($opt)) { }
1147 0 0 if (not $delay_page_create and $page_create_page)
1164 0 0 $delay_page_create ? :
1174 0 0 unless $opt->[3]{'nogui'}
1177 0 0 if (not $delay_page_create and $page_create_page)
1191 0 0 unless $f->{'Sw'}
1193 0 0 unless $nenner
1195 0 0 unless $rows and int $rows
1196 0 0 if ($rows / int($rows) > 0)
1203 0 0 if ($f->y + $f->height > $opt_editor->height)
1212 0 0 if ($buttons)
1213 0 0 if (ref $buttons ne 'ARRAY') { }
1220 0 0 if (not $buttons or $allowed_button{'ok'})
1226 0 0 unless ($dont_use_notebook)
1236 0 0 if ($allowed_button{'oksave'})
1245 0 0 unless ($dont_use_notebook)
1251 0 0 if ($err)
1261 0 0 if (not $buttons or $allowed_button{'apply'})
1272 0 0 if (not $buttons or $allowed_button{'cancel'})
1277 0 0 unless ($dont_use_notebook)
1287 0 0 if (not $buttons or $allowed_button{'undo'})
1297 0 0 if ($self->{'filename'})
1298 0 0 if (not $buttons or $allowed_button{'lastsaved'})
1310 0 0 if (not $nosave and !$buttons || $allowed_button{'save'})
1317 0 0 if ($@ =~ /No Data::Dumper/)
1327 0 0 if (not $buttons or $allowed_button{'defaults'})
1339 0 0 if $callback
1341 0 0 if (not $dont_use_notebook and defined $self->{'raised'})
1349 0 0 if (defined $statusbar)
1353 0 0 if ($opt_editor->can('Popup'))
1357 0 0 if ($wait)
1358 0 0 if ($pack)
1363 0 0 unless $opt_editor->ismapped
1374 0 0 unless $Tk::Getopt::CHECKMARK_ON
1379 0 0 unless $Tk::Getopt::CHECKMARK_OFF
1387 0 0 unless (defined $Tk::Getopt::FILE_IMAGE)
1390 0 0 unless $Tk::Getopt::FILE_IMAGE
1392 0 0 if ($Tk::Getopt::FILE_IMAGE) { }
1401 0 0 unless (defined $Tk::Getopt::CURR_GEOMETRY_IMAGE)
1404 0 0 unless $Tk::Getopt::CURR_GEOMETRY_IMAGE
1406 0 0 if ($Tk::Getopt::CURR_GEOMETRY_IMAGE) { }