Dialog/Backend/GDialog.pm

filter: Statementstmt 28.6% 53 / 185 Branchbran 7.3% 5 / 68 Conditioncond 19.6% 21 / 107 MC/DCmcdc 0.0% 0 / 57 Subroutinesub 45.0% 9 / 20 Podpod 90.9% 10 / 11 totaltotal 21.8% 98 / 448 CC 82 SCAR 45.4
CC
82
Cov
22%
checklist
156.0
new
139.1
yesno
90.0
CRAP 93.9
« Dialog/GNOME.pm ↑ Summary Dialog/KDE.pm »
1 package UI::Dialog::Backend::GDialog;
2 ###############################################################################
3 # Copyright (C) 2004-2016 Kevin C. Krinke <kevin@krinke.ca>
4 #
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License, or (at your option) any later version.
9 #
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 ###############################################################################
19 2 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 2 ▶use FileHandle;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 2 ▶use UI::Dialog::Backend;
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 BEGIN {
27 2 ▶ use vars qw( $VERSION @ISA );
Subroutine BEGIN: called CC=1 SCAR=0.0
28 2 ▶ @ISA = qw( UI::Dialog::Backend );
Subroutine BEGIN: called CC=1 SCAR=0.0
29 2 $VERSION = '1.20';
30 }
31  
32 #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
33 #: Constructor Method
34 #:
35  
36 sub new {
37 1 ▶ my $proto = shift();
Subroutine new: called CC=32 SCAR=49.4
Pod documented
38 1 ▶ my $class = ref($proto) || $proto;
Condition33%1/3
ref $proto || $proto
l!l&&r!l&&!r
010
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
39 1 ▶ my $cfg = ((ref($_[0]) eq "HASH") ? $_[0] : (@_) ? { @_ } : {});
Branch: 2 branches
BranchTrueFalseTotal
ref $_[0] eq 'HASH' ? : 0 1 1
@_ ? : 1 0 1
40 1 my $self = {};
41 1 bless($self, $class);
42 1 $self->{'_state'} = {};
43 1 $self->{'_opts'} = {};
44  
45 #: Dynamic path discovery...
46 1 my $CFG_PATH = $cfg->{'PATH'};
47 1 ▶ if ($CFG_PATH) {
Branch: 2 branches
BranchTrueFalseTotal
if ($CFG_PATH) { } 0 1 1
elsif ($ENV{'PATH'}) { } 1 0 1
48 0 ▶ if (ref($CFG_PATH) eq "ARRAY") {
Branch: 3 branches
BranchTrueFalseTotal
if (ref $CFG_PATH eq 'ARRAY') { } 0 0 0
elsif ($CFG_PATH =~ /:/) { } 0 0 0
elsif (-d $CFG_PATH) { } 0 0 0
49 0 $self->{'PATHS'} = $CFG_PATH;
50 }
51 elsif ($CFG_PATH =~ m!:!) {
52 0 $self->{'PATHS'} = [ split(/:/,$CFG_PATH) ];
53 }
54 elsif (-d $CFG_PATH) {
55 0 $self->{'PATHS'} = [ $CFG_PATH ];
56 }
57 }
58 elsif ($ENV{'PATH'}) {
59 1 $self->{'PATHS'} = [ split(/:/,$ENV{'PATH'}) ];
60 }
61 else {
62 0 $self->{'PATHS'} = '';
63 }
64  
65 1 ▶ $self->{'_opts'}->{'literal'} = $cfg->{'literal'} || 0;
Condition50%1/2
$cfg->{'literal'} || 0
l!l
01
MC/DC0%0/1
$cfg->{'literal'} || 0
$cfg->{'literal'}
Truth table50%1/2
A
A= $cfg->{'literal'}
Aresult
11
00
66 1 ▶ $self->{'_opts'}->{'callbacks'} = $cfg->{'callbacks'} || undef();
Condition50%1/2
$cfg->{'callbacks'} || undef()
l!l
01
MC/DC0%0/1
$cfg->{'callbacks'} || undef()
$cfg->{'callbacks'}
Truth table50%1/2
A
A= $cfg->{'callbacks'}
Aresult
11
00
67 1 ▶ $self->{'_opts'}->{'debug'} = $cfg->{'debug'} || undef();
Condition50%1/2
$cfg->{'debug'} || undef()
l!l
01
MC/DC0%0/1
$cfg->{'debug'} || undef()
$cfg->{'debug'}
Truth table50%1/2
A
A= $cfg->{'debug'}
Aresult
11
00
68 1 ▶ $self->{'_opts'}->{'title'} = $cfg->{'title'} || undef();
Condition50%1/2
$cfg->{'title'} || undef()
l!l
01
MC/DC0%0/1
$cfg->{'title'} || undef()
$cfg->{'title'}
Truth table50%1/2
A
A= $cfg->{'title'}
Aresult
11
00
69 1 ▶ $self->{'_opts'}->{'backtitle'} = $cfg->{'backtitle'} || undef();
Condition50%1/2
$cfg->{'backtitle'} || undef()
l!l
01
MC/DC0%0/1
$cfg->{'backtitle'} || undef()
$cfg->{'backtitle'}
Truth table50%1/2
A
A= $cfg->{'backtitle'}
Aresult
11
00
70 1 ▶ $self->{'_opts'}->{'width'} = $cfg->{'width'} || 65;
Condition50%1/2
$cfg->{'width'} || 65
l!l
01
MC/DC0%0/1
$cfg->{'width'} || 65
$cfg->{'width'}
Truth table50%1/2
A
A= $cfg->{'width'}
Aresult
11
00
71 1 ▶ $self->{'_opts'}->{'height'} = $cfg->{'height'} || 10;
Condition50%1/2
$cfg->{'height'} || 10
l!l
01
MC/DC0%0/1
$cfg->{'height'} || 10
$cfg->{'height'}
Truth table50%1/2
A
A= $cfg->{'height'}
Aresult
11
00
72 1 ▶ $self->{'_opts'}->{'percentage'} = $cfg->{'percentage'} || 1;
Condition50%1/2
$cfg->{'percentage'} || 1
l!l
01
MC/DC0%0/1
$cfg->{'percentage'} || 1
$cfg->{'percentage'}
Truth table50%1/2
A
A= $cfg->{'percentage'}
Aresult
11
00
73 1 ▶ $self->{'_opts'}->{'bin'} ||= $self->_find_bin('gdialog.real') || $self->_find_bin('gdialog') || '/usr/bin/gdialog';
Condition37%3/8
$self->{"_opts"}{"bin"} ||= $self->_find_bin("gdialog.real") || $self->_find_bin("gdialog") || "/usr/bin/gdialog"
l!l&&r!l&&!r
010
$self->_find_bin('gdialog.real') || $self->_find_bin('gdialog') || '/usr/bin/gdialog'
l!l
01
$self->_find_bin("gdialog.real") or $self->_find_bin("gdialog")
l!l&&r!l&&!r
001
MC/DC0%0/3
$self->{"_opts"}{"bin"} ||= $self->_find_bin("gdialog.real") || $self->_find_bin("gdialog") || "/usr/bin/gdialog"
$self->{"_opts"}{"bin"} $self->_find_bin("gdialog.real") $self->_find_bin("gdialog")
Truth table0%0/4
A ||= B or C
A= $self->{"_opts"}{"bin"}B= $self->_find_bin("gdialog.real")C= $self->_find_bin("gdialog")
ABCresult
1XX1
01X1
0011
0000
74 1 ▶ $self->{'_opts'}->{'autoclear'} = $cfg->{'autoclear'} || 0;
Condition50%1/2
$cfg->{'autoclear'} || 0
l!l
01
MC/DC0%0/1
$cfg->{'autoclear'} || 0
$cfg->{'autoclear'}
Truth table50%1/2
A
A= $cfg->{'autoclear'}
Aresult
11
00
75 1 ▶ $self->{'_opts'}->{'clearbefore'} = $cfg->{'clearbefore'} || 0;
Condition50%1/2
$cfg->{'clearbefore'} || 0
l!l
01
MC/DC0%0/1
$cfg->{'clearbefore'} || 0
$cfg->{'clearbefore'}
Truth table50%1/2
A
A= $cfg->{'clearbefore'}
Aresult
11
00
76 1 ▶ $self->{'_opts'}->{'clearafter'} = $cfg->{'clearafter'} || 0;
Condition50%1/2
$cfg->{'clearafter'} || 0
l!l
01
MC/DC0%0/1
$cfg->{'clearafter'} || 0
$cfg->{'clearafter'}
Truth table50%1/2
A
A= $cfg->{'clearafter'}
Aresult
11
00
77 1 ▶ $self->{'_opts'}->{'beepbin'} = $cfg->{'beepbin'} || $self->_find_bin('beep') || '/usr/bin/beep';
Condition40%2/5
$cfg->{'beepbin'} || $self->_find_bin('beep') || '/usr/bin/beep'
l!l
01
$cfg->{"beepbin"} or $self->_find_bin("beep")
l!l&&r!l&&!r
001
MC/DC0%0/2
$cfg->{'beepbin'} || $self->_find_bin('beep') || '/usr/bin/beep'
$cfg->{"beepbin"} $self->_find_bin("beep")
Truth table33%1/3
A or B
A= $cfg->{"beepbin"}B= $self->_find_bin("beep")
ABresult
1X1
011
000
78 1 ▶ $self->{'_opts'}->{'beepbefore'} = $cfg->{'beepbefore'} || 0;
Condition50%1/2
$cfg->{'beepbefore'} || 0
l!l
01
MC/DC0%0/1
$cfg->{'beepbefore'} || 0
$cfg->{'beepbefore'}
Truth table50%1/2
A
A= $cfg->{'beepbefore'}
Aresult
11
00
79 1 ▶ $self->{'_opts'}->{'beepafter'} = $cfg->{'beepafter'} || 0;
Condition50%1/2
$cfg->{'beepafter'} || 0
l!l
01
MC/DC0%0/1
$cfg->{'beepafter'} || 0
$cfg->{'beepafter'}
Truth table50%1/2
A
A= $cfg->{'beepafter'}
Aresult
11
00
80 1 ▶ $self->{'_opts'}->{'timeout'} = $cfg->{'timeout'} || 0;
Condition50%1/2
$cfg->{'timeout'} || 0
l!l
01
MC/DC0%0/1
$cfg->{'timeout'} || 0
$cfg->{'timeout'}
Truth table50%1/2
A
A= $cfg->{'timeout'}
Aresult
11
00
81 1 ▶ $self->{'_opts'}->{'wait'} = $cfg->{'wait'} || 0;
Condition50%1/2
$cfg->{'wait'} || 0
l!l
01
MC/DC0%0/1
$cfg->{'wait'} || 0
$cfg->{'wait'}
Truth table50%1/2
A
A= $cfg->{'wait'}
Aresult
11
00
82 1 ▶ unless (-x $self->{'_opts'}->{'bin'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-x $self->{"_opts"}{"bin"}) 1 0 1
83 1 croak("the gdialog binary could not be found at: ".$self->{'_opts'}->{'bin'});
84 }
85  
86 0 ▶ $self->{'_opts'}->{'trust-input'} = $cfg->{'trust-input'} || 0;
Condition0%0/2
$cfg->{'trust-input'} || 0
l!l
00
MC/DC0%0/1
$cfg->{'trust-input'} || 0
$cfg->{'trust-input'}
Truth table0%0/2
A
A= $cfg->{'trust-input'}
Aresult
11
00
87  
88 0 ▶ $self->{'test_mode'} = $cfg->{'test_mode'} if exists $cfg->{'test_mode'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $cfg->{"test_mode"} 0 0 0
89 0 $self->{'test_mode_result'} = '';
90  
91 0 return($self);
92 }
93  
94 #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
95 #: Private Methods
96 #:
97  
98 2 my $SIG_CODE = {};
99 sub _del_gauge {
100 0 ▶ my $CODE = $SIG_CODE->{$$};
Subroutine _del_gauge: not called CC=2 SCAR=17.9
101 0 ▶ unless (not ref($CODE)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (not ref $CODE) 0 0 0
102 0 delete($CODE->{'_GAUGE'});
103 0 $CODE->rv('1');
104 0 $CODE->rs('null');
105 0 $CODE->ra('null');
106 0 $SIG_CODE->{$$} = "";
107 }
108 }
109  
110 sub append_format_base {
111 0 ▶ my ($self,$args,$fmt) = @_;
Subroutine append_format_base: not called CC=1 SCAR=6.9
Pod undocumented
112 0 return $fmt;
113 }
114  
115  
116 #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
117 #: Public Methods
118 #:
119  
120 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
121 #: Ask a binary question (Yes/No)
122 sub yesno {
123 0 ▶ my $self = shift();
Subroutine yesno: not called CC=9 SCAR=45.0
Pod documented
124 0 ▶ my $caller = (caller(1))[3] || 'main';
Condition0%0/2
(caller 1)[3] || 'main'
l!l
00
MC/DC0%0/1
(caller 1)[3] || 'main'
(caller 1)[3]
Truth table0%0/2
A
A= (caller 1)[3]
Aresult
11
00
125 0 ▶ $caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller;
Branch: 1 branch
BranchTrueFalseTotal
$caller =~ /^UI\:\:Dialog\:\:Backend\:\:/ ? : 0 0 0
Condition0%0/2
(caller 2)[3] or "main"
l!l
00
MC/DC0%0/1
(caller 2)[3] or "main"
(caller 2)[3]
Truth table0%0/2
A
A= (caller 2)[3]
Aresult
11
00
126 0 ▶ if ($_[0] && $_[0] eq 'caller') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0] and $_[0] eq "caller") 0 0 0
Condition0%0/3
$_[0] and $_[0] eq "caller"
!ll&&!rl&&r
000
MC/DC0%0/2
$_[0] and $_[0] eq "caller"
$_[0] $_[0] eq "caller"
Truth table0%0/3
A and B
A= $_[0]B= $_[0] eq "caller"
ABresult
0X0
100
111
127 0 shift(); $caller = shift();
128 }
129 0 my $args = $self->_pre($caller,@_);
130  
131 0 my $fmt = $self->prepare_format($args);
132 0 $fmt = $self->append_format_base($args,$fmt);
133 0 $fmt = $self->append_format($fmt,'--yesno {{text}} {{height}} {{width}}');
134 my $command = $self->prepare_command
135 ( $args, $fmt,
136 0 text => $self->make_kvt($args,$args->{'text'}),
137 );
138  
139 0 my $rv = $self->command_state($command);
140 0 ▶ if ($rv && $rv >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rv and $rv >= 1) { } 0 0 0
Condition0%0/3
$rv and $rv >= 1
!ll&&!rl&&r
000
MC/DC0%0/2
$rv and $rv >= 1
$rv $rv >= 1
Truth table0%0/3
A and B
A= $rvB= $rv >= 1
ABresult
0X0
100
111
141 0 $self->ra("NO");
142 0 $self->rs("NO");
143 0 $self->rv($rv);
144 } else {
145 0 $self->ra("YES");
146 0 $self->rs("YES");
147 0 $self->rv('null');
148 }
149 0 $self->_post($args);
150 0 ▶ return($rv == 0 ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
151 }
152  
153 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
154 #: Text entry
155 sub inputbox {
156 0 ▶ my $self = shift();
Subroutine inputbox: not called CC=8 SCAR=42.8
Pod documented
157 0 ▶ my $caller = (caller(1))[3] || 'main';
Condition0%0/2
(caller 1)[3] || 'main'
l!l
00
MC/DC0%0/1
(caller 1)[3] || 'main'
(caller 1)[3]
Truth table0%0/2
A
A= (caller 1)[3]
Aresult
11
00
158 0 ▶ $caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller;
Branch: 1 branch
BranchTrueFalseTotal
$caller =~ /^UI\:\:Dialog\:\:Backend\:\:/ ? : 0 0 0
Condition0%0/2
(caller 2)[3] or "main"
l!l
00
MC/DC0%0/1
(caller 2)[3] or "main"
(caller 2)[3]
Truth table0%0/2
A
A= (caller 2)[3]
Aresult
11
00
159 0 ▶ if ($_[0] && $_[0] eq 'caller') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0] and $_[0] eq "caller") 0 0 0
Condition0%0/3
$_[0] and $_[0] eq "caller"
!ll&&!rl&&r
000
MC/DC0%0/2
$_[0] and $_[0] eq "caller"
$_[0] $_[0] eq "caller"
Truth table0%0/3
A and B
A= $_[0]B= $_[0] eq "caller"
ABresult
0X0
100
111
160 0 shift(); $caller = shift();
161 }
162 0 my $args = $self->_pre($caller,@_);
163  
164 0 my $fmt = $self->prepare_format($args);
165 0 $fmt = $self->append_format_base($args,$fmt);
166 0 $fmt = $self->append_format($fmt,'--inputbox');
167 0 $fmt = $self->append_format($fmt,'{{text}} {{height}} {{width}} {{entry}}');
168 my $command = $self->prepare_command
169 ( $args, $fmt,
170 text => $self->make_kvt($args,$args->{'text'}),
171 0 ▶ entry => $self->make_kvl($args,($args->{'init'}||$args->{'entry'})),
Condition0%0/3
$args->{'init'} || $args->{'entry'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$args->{'init'} || $args->{'entry'}
$args->{'init'} $args->{'entry'}
Truth table0%0/3
A || B
A= $args->{'init'}B= $args->{'entry'}
ABresult
1X1
011
000
172 );
173  
174 0 my ($rv,$text) = $self->command_string($command);
175 0 $self->_post($args);
176 0 ▶ return($rv == 0 ? $text : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
177 }
178 #: password boxes aren't supported by gdialog
179 sub password {
180 0 ▶ carp("Password entry fields are not supported by GDialog.");
Subroutine password: not called CC=1 SCAR=6.9
Pod documented
181 0 return(1); #: Cancel every time.
182 }
183  
184 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
185 #: Text box
186 sub msgbox {
187 0 ▶ my $self = shift();
Subroutine msgbox: not called CC=8 SCAR=42.8
Pod documented
188 0 ▶ my $caller = (caller(1))[3] || 'main';
Condition0%0/2
(caller 1)[3] || 'main'
l!l
00
MC/DC0%0/1
(caller 1)[3] || 'main'
(caller 1)[3]
Truth table0%0/2
A
A= (caller 1)[3]
Aresult
11
00
189 0 ▶ $caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller;
Branch: 1 branch
BranchTrueFalseTotal
$caller =~ /^UI\:\:Dialog\:\:Backend\:\:/ ? : 0 0 0
Condition0%0/2
(caller 2)[3] or "main"
l!l
00
MC/DC0%0/1
(caller 2)[3] or "main"
(caller 2)[3]
Truth table0%0/2
A
A= (caller 2)[3]
Aresult
11
00
190 0 ▶ if ($_[0] && $_[0] eq 'caller') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0] and $_[0] eq "caller") 0 0 0
Condition0%0/3
$_[0] and $_[0] eq "caller"
!ll&&!rl&&r
000
MC/DC0%0/2
$_[0] and $_[0] eq "caller"
$_[0] $_[0] eq "caller"
Truth table0%0/3
A and B
A= $_[0]B= $_[0] eq "caller"
ABresult
0X0
100
111
191 0 shift(); $caller = shift();
192 }
193 0 my $args = $self->_pre($caller,@_);
194  
195 0 my $fmt = $self->prepare_format($args);
196 0 $fmt = $self->append_format_base($args,$fmt);
197 0 $fmt = $self->append_format($fmt,'--scrolltext');
198 0 ▶ if ($args->{'infobox'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args->{'infobox'}) { } 0 0 0
199 0 $fmt = $self->append_format($fmt,'--infobox');
200 }
201 else {
202 0 $fmt = $self->append_format($fmt,'--msgbox');
203 }
204 0 $fmt = $self->append_format($fmt,'{{text}} {{height}} {{width}}');
205 my $command = $self->prepare_command
206 ( $args, $fmt,
207 0 text => $self->make_kvt($args,$args->{'text'}),
208 );
209  
210 0 my $rv = $self->command_state($command);
211 0 $self->_post($args);
212 0 ▶ return($rv == 0 ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
213 }
214 sub infobox {
215 0 ▶ my $self = shift();
Subroutine infobox: not called CC=2 SCAR=17.9
Pod documented
216 0 ▶ return($self->msgbox('caller',((caller(1))[3]||'main'),@_,'infobox',1));
Condition0%0/2
(caller 1)[3] || 'main'
l!l
00
MC/DC0%0/1
(caller 1)[3] || 'main'
(caller 1)[3]
Truth table0%0/2
A
A= (caller 1)[3]
Aresult
11
00
217 }
218  
219 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
220 #: File box
221 sub textbox {
222 0 ▶ my $self = shift();
Subroutine textbox: not called CC=8 SCAR=42.8
Pod documented
223 0 ▶ my $caller = (caller(1))[3] || 'main';
Condition0%0/2
(caller 1)[3] || 'main'
l!l
00
MC/DC0%0/1
(caller 1)[3] || 'main'
(caller 1)[3]
Truth table0%0/2
A
A= (caller 1)[3]
Aresult
11
00
224 0 ▶ $caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller;
Branch: 1 branch
BranchTrueFalseTotal
$caller =~ /^UI\:\:Dialog\:\:Backend\:\:/ ? : 0 0 0
Condition0%0/2
(caller 2)[3] or "main"
l!l
00
MC/DC0%0/1
(caller 2)[3] or "main"
(caller 2)[3]
Truth table0%0/2
A
A= (caller 2)[3]
Aresult
11
00
225 0 ▶ if ($_[0] && $_[0] eq 'caller') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0] and $_[0] eq "caller") 0 0 0
Condition0%0/3
$_[0] and $_[0] eq "caller"
!ll&&!rl&&r
000
MC/DC0%0/2
$_[0] and $_[0] eq "caller"
$_[0] $_[0] eq "caller"
Truth table0%0/3
A and B
A= $_[0]B= $_[0] eq "caller"
ABresult
0X0
100
111
226 0 shift(); $caller = shift();
227 }
228 0 my $args = $self->_pre($caller,@_);
229  
230 0 my $fmt = $self->prepare_format($args);
231 0 $fmt = $self->append_format_base($args,$fmt);
232 0 $fmt = $self->append_format($fmt,'--textbox');
233 0 $fmt = $self->append_format($fmt,'{{path}} {{height}} {{width}}');
234 my $command = $self->prepare_command
235 ( $args, $fmt,
236 0 ▶ path => $self->make_kvl($args,($args->{'path'}||'.')),
Condition0%0/2
$args->{'path'} || '.'
l!l
00
MC/DC0%0/1
$args->{'path'} || '.'
$args->{'path'}
Truth table0%0/2
A
A= $args->{'path'}
Aresult
11
00
237 );
238  
239 0 my ($rv,$text) = $self->command_string($command);
240 0 $self->_post($args);
241 0 ▶ return($rv == 0 ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
242 }
243  
244 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
245 #: a simple menu list
246 sub menu {
247 0 ▶ my $self = shift();
Subroutine menu: not called CC=8 SCAR=42.8
Pod documented
248 0 ▶ my $caller = (caller(1))[3] || 'main';
Condition0%0/2
(caller 1)[3] || 'main'
l!l
00
MC/DC0%0/1
(caller 1)[3] || 'main'
(caller 1)[3]
Truth table0%0/2
A
A= (caller 1)[3]
Aresult
11
00
249 0 ▶ $caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller;
Branch: 1 branch
BranchTrueFalseTotal
$caller =~ /^UI\:\:Dialog\:\:Backend\:\:/ ? : 0 0 0
Condition0%0/2
(caller 2)[3] or "main"
l!l
00
MC/DC0%0/1
(caller 2)[3] or "main"
(caller 2)[3]
Truth table0%0/2
A
A= (caller 2)[3]
Aresult
11
00
250 0 ▶ if ($_[0] && $_[0] eq 'caller') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0] and $_[0] eq "caller") 0 0 0
Condition0%0/3
$_[0] and $_[0] eq "caller"
!ll&&!rl&&r
000
MC/DC0%0/2
$_[0] and $_[0] eq "caller"
$_[0] $_[0] eq "caller"
Truth table0%0/3
A and B
A= $_[0]B= $_[0] eq "caller"
ABresult
0X0
100
111
251 0 shift(); $caller = shift();
252 }
253 0 my $args = $self->_pre($caller,@_);
254  
255 0 ▶ $args->{'listheight'} ||= $args->{'menuheight'};
Condition0%0/3
$args->{"listheight"} ||= $args->{"menuheight"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$args->{"listheight"} ||= $args->{"menuheight"}
$args->{"listheight"} $args->{"menuheight"}
Truth table0%0/3
A ||= B
A= $args->{"listheight"}B= $args->{"menuheight"}
ABresult
1X1
011
000
256  
257 0 my $fmt = $self->prepare_format($args);
258 0 $fmt = $self->append_format_base($args,$fmt);
259 0 $fmt = $self->append_format($fmt,'--menu');
260 0 $fmt = $self->append_format($fmt,'{{text}} {{height}} {{width}} {{listheight}} {{list}}');
261 my $command = $self->prepare_command
262 ( $args, $fmt,
263 0 text => $self->make_kvt($args,$args->{'text'}),
264 );
265  
266 0 my ($rv,$selected) = $self->command_string($command);
267 0 $self->_post($args);
268 0 ▶ return($rv == 0 ? $selected : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
269 }
270  
271 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
272 #: a check list
273 sub checklist {
274 0 ▶ my $self = shift();
Subroutine checklist: not called CC=12 SCAR=50.5
Pod documented
275 0 ▶ my $caller = (caller(1))[3] || 'main';
Condition0%0/2
(caller 1)[3] || 'main'
l!l
00
MC/DC0%0/1
(caller 1)[3] || 'main'
(caller 1)[3]
Truth table0%0/2
A
A= (caller 1)[3]
Aresult
11
00
276 0 ▶ $caller = ($caller =~ /^UI\:\:Dialog\:\:Backend\:\:/) ? ((caller(2))[3]||'main') : $caller;
Branch: 1 branch
BranchTrueFalseTotal
$caller =~ /^UI\:\:Dialog\:\:Backend\:\:/ ? : 0 0 0
Condition0%0/2
(caller 2)[3] or "main"
l!l
00
MC/DC0%0/1
(caller 2)[3] or "main"
(caller 2)[3]
Truth table0%0/2
A
A= (caller 2)[3]
Aresult
11
00
277 0 ▶ if ($_[0] && $_[0] eq 'caller') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0] and $_[0] eq "caller") 0 0 0
Condition0%0/3
$_[0] and $_[0] eq "caller"
!ll&&!rl&&r
000
MC/DC0%0/2
$_[0] and $_[0] eq "caller"
$_[0] $_[0] eq "caller"
Truth table0%0/3
A and B
A= $_[0]B= $_[0] eq "caller"
ABresult
0X0
100
111
278 0 shift(); $caller = shift();
279 }
280 0 my $args = $self->_pre($caller,@_);
281  
282 $args->{'listheight'} = $args->{'menuheight'}
283 0 ▶ if exists $args->{'menuheight'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $args->{"menuheight"} 0 0 0
284  
285 0 my $fmt = $self->prepare_format($args);
286 0 $fmt = $self->append_format_base($args,$fmt);
287 0 $fmt = $self->append_format($fmt,'--separate-output');
288 0 ▶ $args->{radiolist} ||= 0;
Condition0%0/2
$args->{"radiolist"} ||= 0
l!l
00
MC/DC0%0/1
$args->{"radiolist"} ||= 0
$args->{"radiolist"}
Truth table0%0/2
A
A= $args->{"radiolist"}
Aresult
11
00
289 0 ▶ if ($args->{radiolist}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args->{'radiolist'}) { } 0 0 0
290 0 $fmt = $self->append_format($fmt,'--radiolist');
291 }
292 else {
293 0 $fmt = $self->append_format($fmt,'--checklist');
294 }
295 0 $fmt = $self->append_format($fmt,'{{text}} {{height}} {{width}} {{listheight}} {{list}}');
296 my $command = $self->prepare_command
297 ( $args, $fmt,
298 text => $self->make_kvt($args,$args->{'text'}),
299 0 listheight => $self->make_kvl($args,$args->{'listheight'})
300 );
301  
302 0 ▶ if ($args->{radiolist}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args->{"radiolist"}) 0 0 0
303 0 my ($rv,$selected) = $self->command_string($command);
304 0 ▶ return($rv == 0 ? $selected : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
305 }
306 0 my ($rv,$selected) = $self->command_array($command);
307 0 ▶ return($rv == 0 ? @{$selected} : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
308 }
309 #: a radio button list
310 sub radiolist {
311 0 ▶ my $self = shift();
Subroutine radiolist: not called CC=2 SCAR=17.9
Pod documented
312 0 ▶ return($self->checklist('caller',((caller(1))[3]||'main'),@_,'radiolist',1));
Condition0%0/2
(caller 1)[3] || 'main'
l!l
00
MC/DC0%0/1
(caller 1)[3] || 'main'
(caller 1)[3]
Truth table0%0/2
A
A= (caller 1)[3]
Aresult
11
00
313 }
314  
315 2 1;
316  
« Dialog/GNOME.pm ↑ Summary Dialog/KDE.pm »