Dialog/Backend/Zenity.pm

filter: Statementstmt 16.0% 64 / 398 Branchbran 3.6% 5 / 138 Conditioncond 10.2% 20 / 196 MC/DCmcdc 0.0% 0 / 105 Subroutinesub 27.9% 12 / 43 Podpod 63.3% 19 / 30 totaltotal 13.1% 120 / 910 CC 156 SCAR 48.4
CC
156
Cov
12%
list
506.0
gauge_start
156.0
new
146.3
CRAP 126.6
« Dialog/Backend/Whiptail.pm ↑ Summary Dialog/GNOME.pm »
1 package UI::Dialog::Backend::Zenity;
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 Cwd qw( abs_path );
Subroutine BEGIN: called CC=1 SCAR=0.0
25 2 ▶use UI::Dialog::Backend;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 2 ▶use File::Slurp;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 2 ▶use String::ShellQuote;
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 BEGIN {
30 2 ▶ use vars qw( $VERSION @ISA );
Subroutine BEGIN: called CC=1 SCAR=0.0
31 2 ▶ @ISA = qw( UI::Dialog::Backend );
Subroutine BEGIN: called CC=1 SCAR=0.0
32 2 $VERSION = '1.20';
33 }
34  
35 #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
36 #: Constructor Method
37 #:
38  
39 sub new {
40 1 ▶ my $proto = shift();
Subroutine new: called CC=32 SCAR=49.9
Pod documented
41 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
42 1 ▶ my $cfg = ((ref($_[0]) eq "HASH") ? $_[0] : (@_) ? { @_ } : {});
Branch: 2 branches
BranchTrueFalseTotal
ref $_[0] eq 'HASH' ? : 0 1 1
@_ ? : 1 0 1
43 1 my $self = {};
44 1 bless($self, $class);
45 1 $self->{'_state'} = {};
46 1 $self->{'_opts'} = {};
47  
48 #: Dynamic path discovery...
49 1 my $CFG_PATH = $cfg->{'PATH'};
50 1 ▶ if ($CFG_PATH) {
Branch: 2 branches
BranchTrueFalseTotal
if ($CFG_PATH) { } 0 1 1
elsif ($ENV{'PATH'}) { } 1 0 1
51 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
52 0 $self->{'PATHS'} = $CFG_PATH;
53 }
54 elsif ($CFG_PATH =~ m!:!) {
55 0 $self->{'PATHS'} = [ split(/:/,$CFG_PATH) ];
56 }
57 elsif (-d $CFG_PATH) {
58 0 $self->{'PATHS'} = [ $CFG_PATH ];
59 }
60 }
61 elsif ($ENV{'PATH'}) {
62 1 $self->{'PATHS'} = [ split(/:/,$ENV{'PATH'}) ];
63 }
64 else {
65 0 $self->{'PATHS'} = '';
66 }
67  
68 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
69 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
70 1 ▶ $self->{'_opts'}->{'window-icon'} = $cfg->{'window-icon'} || undef();
Condition50%1/2
$cfg->{'window-icon'} || undef()
l!l
01
MC/DC0%0/1
$cfg->{'window-icon'} || undef()
$cfg->{'window-icon'}
Truth table50%1/2
A
A= $cfg->{'window-icon'}
Aresult
11
00
71 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
72 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
73 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
74 1 ▶ $self->{'_opts'}->{'display'} = $cfg->{'display'} || undef();
Condition50%1/2
$cfg->{'display'} || undef()
l!l
01
MC/DC0%0/1
$cfg->{'display'} || undef()
$cfg->{'display'}
Truth table50%1/2
A
A= $cfg->{'display'}
Aresult
11
00
75 1 ▶ $self->{'_opts'}->{'name'} = $cfg->{'name'} || undef();
Condition50%1/2
$cfg->{'name'} || undef()
l!l
01
MC/DC0%0/1
$cfg->{'name'} || undef()
$cfg->{'name'}
Truth table50%1/2
A
A= $cfg->{'name'}
Aresult
11
00
76 1 ▶ $self->{'_opts'}->{'class'} = $cfg->{'class'} || undef();
Condition50%1/2
$cfg->{'class'} || undef()
l!l
01
MC/DC0%0/1
$cfg->{'class'} || undef()
$cfg->{'class'}
Truth table50%1/2
A
A= $cfg->{'class'}
Aresult
11
00
77 1 $self->{'_opts'}->{'bin'} = $self->_find_bin('zenity');
78 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
79 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
80 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
81 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
82 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
83 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
84 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
85 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
86 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
87 1 ▶ unless (-x $self->{'_opts'}->{'bin'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-x $self->{"_opts"}{"bin"}) 1 0 1
88 1 croak("the zenity binary could not be found at: ".$self->{'_opts'}->{'bin'});
89 }
90  
91 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
92  
93 0 my $command = $self->{'_opts'}->{'bin'}." --version";
94 0 my $version = `$command 2>&1`;
95 0 chomp( $version );
96 0 ▶ $self->{'ZENITY_VERSION'} = $version || '1';
Condition0%0/2
$version || '1'
l!l
00
MC/DC0%0/1
$version || '1'
$version
Truth table0%0/2
A
A= $version
Aresult
11
00
97  
98 0 ▶ $self->{'test_mode'} = $cfg->{'test_mode'} if exists $cfg->{'test_mode'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $cfg->{"test_mode"} 0 0 0
99 0 $self->{'test_mode_result'} = '';
100  
101 0 return($self);
102 }
103  
104 #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
105 #: Private Methods
106 #:
107  
108 2 my $SIG_CODE = {};
109 sub _del_gauge {
110 #: this is beyond self...
111 0 ▶ my $CODE = $SIG_CODE->{$$};
Subroutine _del_gauge: not called CC=2 SCAR=17.9
112 0 ▶ unless (not ref($CODE)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (not ref $CODE) 0 0 0
113 0 delete($CODE->{'_GAUGE'});
114 0 $CODE->rv('1');
115 0 $CODE->rs('null');
116 0 $CODE->ra('null');
117 0 $SIG_CODE->{$$} = "";
118 }
119 }
120 sub append_format_base {
121 0 ▶ my ($self,$args,$fmt) = @_;
Subroutine append_format_base: not called CC=1 SCAR=6.9
Pod undocumented
122 0 $ENV{'ZENITY_CANCEL'} = '1';
123 0 $ENV{'ZENITY_ERROR'} = '254';
124 0 $ENV{'ZENITY_ESC'} = '255';
125 0 $ENV{'ZENITY_EXTRA'} = '3';
126 0 $ENV{'ZENITY_HELP'} = '2';
127 0 $ENV{'ZENITY_OK'} = '0';
128 0 $fmt = $self->append_format_check($args,$fmt,'window-icon','--window-icon {{window-icon}}');
129 0 $fmt = $self->append_format_check($args,$fmt,'width','--width {{width}}');
130 0 $fmt = $self->append_format_check($args,$fmt,'height','--height {{height}}');
131 0 $fmt = $self->append_format_check($args,$fmt,'display','--display {{display}}');
132 0 $fmt = $self->append_format_check($args,$fmt,'name','--name {{name}}');
133 0 $fmt = $self->append_format_check($args,$fmt,'class','--class {{class}}');
134  
135 0 return $fmt;
136 }
137  
138 sub _is_bad_version {
139 # my $self = shift();
140 # my ($d_maj, $d_min, $d_mac) = ( 1, 4, 0 );
141 # my ($z_maj, $z_min, $z_mac) = ( 0, 0, 0 );
142 # my $zenity_version = $self->{'ZENITY_VERSION'} || '0.0.0';
143 # if ( $zenity_version =~ m!^(\d+)\.(\d+)\.(\d+)$! ) {
144 # ($z_maj, $z_min, $z_mac) = ( $1, $2, $3 );
145 # }
146 # if ( ( $d_maj < $z_maj ) ||
147 # ( $d_maj == $z_maj && $d_min < $z_min ) ||
148 # ( $d_maj == $z_maj && $d_min == $z_min && $d_mac < $z_mac )
149 # ) {
150 # return(0);
151 # }
152 0 ▶ return(1);
Subroutine _is_bad_version: not called CC=1 SCAR=6.9
153 }
154  
155 #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
156 #: Override Inherited Methods
157 #:
158  
159 # May want to override Backend::perform_command(). Not sure.
160 #: run command and return the rv and any text output from stderr
161 sub perform_command {
162 0 ▶ my $self = $_[0];
Subroutine perform_command: not called CC=4 SCAR=30.0
Pod undocumented
163 0 my $cmnd = $_[1];
164 0 ▶ if ($self->is_unit_test_mode()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->is_unit_test_mode) 0 0 0
165 0 $self->{'test_mode_result'} = $cmnd;
166 0 return (0,'test_mode_result');
167 }
168 0 $self->_debug("perform_command: ".$cmnd.";");
169 0 ▶ my $null_dev = $^O =~ /win32/i ? 'NUL:' : '/dev/null';
Branch: 1 branch
BranchTrueFalseTotal
$^O =~ /win32/i ? : 0 0 0
170 0 my $tmp_stderr = $self->gen_tempfile_name();
171 0 system($cmnd." 2> $null_dev > ".$tmp_stderr);
172 0 my $rv = $? >> 8;
173 0 my $text = read_file($tmp_stderr);
174 0 ▶ unlink($tmp_stderr) if -f $tmp_stderr;
Branch: 1 branch
BranchTrueFalseTotal
if -f $tmp_stderr 0 0 0
175 0 $self->_debug("perform_command: stderr=".shell_quote($text),2);
176 0 return ($rv,$text);
177 }
178  
179  
180 #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
181 #: Public Methods
182 #:
183  
184 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
185 #: Ask a binary question (Yes/No)
186 sub question {
187 0 ▶ my $self = shift();
Subroutine question: not called CC=9 SCAR=45.0
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,'--question --text {{text}}');
198 my $command = $self->prepare_command
199 ( $args, $fmt,
200 0 text => $self->make_kvt($args,$args->{'text'}),
201 );
202  
203 0 my $rv = $self->command_state($command);
204 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
205 0 $self->ra("NO");
206 0 $self->rs("NO");
207 }
208 else {
209 0 $self->ra("YES");
210 0 $self->rs("YES");
211 }
212 0 $self->_post($args);
213 0 ▶ return($rv == 0 ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
214 }
215 #: Zenity doesn't support alternation of the buttons like gdialog et al.
216 #: so here we just wrap for compliance.
217 sub yesno {
218 0 ▶ my $self = shift();
Subroutine yesno: not called CC=2 SCAR=17.9
Pod documented
219 0 ▶ return($self->question('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
220 }
221 sub noyes {
222 0 ▶ my $self = shift();
Subroutine noyes: not called CC=2 SCAR=17.9
Pod undocumented
223 0 ▶ return($self->question('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 }
225  
226 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
227 #: Text entry
228 sub entry {
229 0 ▶ my $self = shift();
Subroutine entry: not called CC=9 SCAR=45.0
Pod undocumented
230 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
231 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
232 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
233 0 shift(); $caller = shift();
234 }
235 0 my $args = $self->_pre($caller,@_);
236  
237 0 ▶ $args->{'entry'} ||= ($args->{'init'} || $args->{'entry'});
Condition0%0/6
$args->{"entry"} ||= $args->{"init"} || $args->{"entry"}
l!l&&r!l&&!r
000
$args->{'init'} || $args->{'entry'}
l!l&&r!l&&!r
000
MC/DC0%0/3
$args->{"entry"} ||= $args->{"init"} || $args->{"entry"}
$args->{"entry"} $args->{'init'} $args->{'entry'}
Truth table0%0/4
A ||= B || C
A= $args->{"entry"}B= $args->{'init'}C= $args->{'entry'}
ABCresult
1XX1
01X1
0011
0000
238  
239 0 my $fmt = $self->prepare_format($args);
240 0 $fmt = $self->append_format_base($args,$fmt);
241 0 $fmt = $self->append_format($fmt,'--entry');
242 0 $fmt = $self->append_format_check($args,$fmt,'hide-text','--hide-text');
243 0 $fmt = $self->append_format_check($args,$fmt,'entry','--entry-text {{entry}}');
244 0 $fmt = $self->append_format($fmt,'--text {{text}}');
245 my $command = $self->prepare_command
246 ( $args, $fmt,
247 0 text => $self->make_kvt($args,$args->{'text'}),
248 );
249  
250 0 my ($rv,$text) = $self->command_string($command);
251 0 $self->_post($args);
252 0 ▶ return($rv == 0 ? $text : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
253 }
254 sub inputbox {
255 0 ▶ my $self = shift();
Subroutine inputbox: not called CC=2 SCAR=17.9
Pod documented
256 0 ▶ return($self->entry('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
257 }
258 sub password {
259 0 ▶ my $self = shift();
Subroutine password: not called CC=2 SCAR=17.9
Pod documented
260 0 ▶ return($self->entry('caller',((caller(1))[3]||'main'),@_,'hide-text',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
261 }
262  
263 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
264 #: Text box
265 sub info {
266 0 ▶ my $self = shift();
Subroutine info: not called CC=9 SCAR=45.0
Pod undocumented
267 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
268 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
269 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
270 0 shift(); $caller = shift();
271 }
272 0 my $args = $self->_pre($caller,@_);
273  
274 0 my $fmt = $self->prepare_format($args);
275 0 $fmt = $self->append_format_base($args,$fmt);
276 0 ▶ if ($args->{'error'}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($args->{'error'}) { } 0 0 0
elsif ($args->{'warning'}) { } 0 0 0
277 0 $fmt = $self->append_format($fmt,'--error');
278 }
279 elsif ($args->{'warning'}) {
280 0 $fmt = $self->append_format($fmt,'--warning');
281 }
282 else {
283 0 $fmt = $self->append_format($fmt,'--info');
284 }
285 0 $fmt = $self->append_format($fmt,'--text {{text}}');
286 my $command = $self->prepare_command
287 ( $args, $fmt,
288 0 text => $self->make_kvt($args,$args->{'text'}),
289 );
290  
291 0 my $rv = $self->command_state($command);
292 0 $self->_post($args);
293 0 ▶ return($rv == 0 ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
294 }
295 sub infobox {
296 0 ▶ my $self = shift();
Subroutine infobox: not called CC=2 SCAR=17.9
Pod undocumented
297 0 ▶ return($self->info('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
298 }
299 sub msgbox {
300 0 ▶ my $self = shift();
Subroutine msgbox: not called CC=2 SCAR=17.9
Pod documented
301 0 ▶ return($self->info('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
302 }
303 sub error {
304 0 ▶ my $self = shift();
Subroutine error: not called CC=2 SCAR=17.9
Pod undocumented
305 0 ▶ return($self->info('caller',((caller(1))[3]||'main'),@_,'error',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
306 }
307 sub warning {
308 0 ▶ my $self = shift();
Subroutine warning: not called CC=2 SCAR=17.9
Pod undocumented
309 0 ▶ return($self->info('caller',((caller(1))[3]||'main'),@_,'warning',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
310 }
311  
312 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
313 #: File box
314 sub text_info {
315 0 ▶ my $self = shift();
Subroutine text_info: not called CC=8 SCAR=42.8
Pod undocumented
316 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
317 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
318 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
319 0 shift(); $caller = shift();
320 }
321 0 my $args = $self->_pre($caller,@_);
322  
323 0 ▶ my $filename = $args->{'path'} || $args->{'filename'};
Condition0%0/3
$args->{'path'} || $args->{'filename'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$args->{'path'} || $args->{'filename'}
$args->{'path'} $args->{'filename'}
Truth table0%0/3
A || B
A= $args->{'path'}B= $args->{'filename'}
ABresult
1X1
011
000
324 0 my $fmt = $self->prepare_format($args);
325 0 $fmt = $self->append_format_base($args,$fmt);
326 0 $fmt = $self->append_format($fmt,'--text-info');
327 0 $fmt = $self->append_format_check($args,$fmt,'editable','--editable');
328 0 $fmt = $self->append_format($fmt,'--filename {{filename}}');
329 my $command = $self->prepare_command
330 ( $args, $fmt,
331 0 text => $self->make_kvt($args,$args->{'text'}),
332 filename => $self->make_kvl($args,$filename)
333 );
334  
335 0 my ($rv,$text) = $self->command_string($command);
336 0 $self->_post($args);
337 0 ▶ return($rv == 0 ? $text : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
338 }
339 sub textbox {
340 0 ▶ my $self = shift();
Subroutine textbox: not called CC=2 SCAR=17.9
Pod documented
341 0 ▶ return($self->text_info('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
342 }
343 sub editbox {
344 0 ▶ my $self = shift();
Subroutine editbox: not called CC=2 SCAR=17.9
Pod documented
345 0 ▶ return($self->text_info('caller',((caller(1))[3]||'main'),@_,'editable',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
346 }
347  
348 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
349 #: Lists
350 sub list {
351 0 ▶ my $self = shift();
Subroutine list: not called CC=22 SCAR=62.3
Pod undocumented
352 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
353 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
354 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
355 0 shift(); $caller = shift();
356 }
357 0 my $args = $self->_pre($caller,@_);
358  
359 0 my $fmt = $self->prepare_format($args);
360 0 $fmt = $self->append_format_base($args,$fmt);
361 0 $fmt = $self->append_format($fmt,'--list');
362 0 ▶ $args->{'checklist'} ||= 0;
Condition0%0/2
$args->{"checklist"} ||= 0
l!l
00
MC/DC0%0/1
$args->{"checklist"} ||= 0
$args->{"checklist"}
Truth table0%0/2
A
A= $args->{"checklist"}
Aresult
11
00
363 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
364 0 ▶ if ($args->{'checklist'}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($args->{'checklist'}) { } 0 0 0
elsif ($args->{'radiolist'}) { } 0 0 0
365 0 $fmt = $self->append_format($fmt,'--checklist');
366 }
367 elsif ($args->{'radiolist'}) {
368 0 $fmt = $self->append_format($fmt,'--radiolist');
369 }
370 0 $fmt = $self->append_format($fmt,"--separator '\\n'");
371  
372 0 ▶ if (ref($args->{'list'}) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $args->{'list'} eq 'ARRAY') { } 0 0 0
373 0 ▶ if ($args->{'checklist'}||$args->{'radiolist'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args->{'checklist'} or $args->{'radiolist'}) { } 0 0 0
Condition0%0/3
$args->{"checklist"} or $args->{"radiolist"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$args->{"checklist"} or $args->{"radiolist"}
$args->{"checklist"} $args->{"radiolist"}
Truth table0%0/3
A or B
A= $args->{"checklist"}B= $args->{"radiolist"}
ABresult
1X1
011
000
374 0 $fmt = $self->append_format($fmt,'--column " " --column " " --column " "');
375 } else {
376 0 $fmt = $self->append_format($fmt,'--column " " --column " "');
377 }
378 0 ▶ while (@{$args->{'list'}}) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$args->{"list"};}) 0 0 0
379 0 my $item = shift(@{$args->{'list'}});
380 0 $self->clean_format($args->{'trust-input'},\$item);
381 0 my $info = shift(@{$args->{'list'}});
382 0 ▶ if (ref($info) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $info eq 'ARRAY') { } 0 0 0
383 0 $self->clean_format($args->{'trust-input'},\$info->[0]);
384 0 ▶ $fmt = $self->append_format($fmt,'"'.(($info->[1]) ? 'TRUE' : 'FALSE').'"');
Branch: 1 branch
BranchTrueFalseTotal
$info->[1] ? : 0 0 0
385 0 $fmt = $self->append_format($fmt,'"'.$item.'"');
386 0 $fmt = $self->append_format($fmt,'"'.$info->[0].'"');
387 }
388 else {
389 0 $self->clean_format($args->{'trust-input'},\$info);
390 0 $fmt = $self->append_format($fmt,'"'.$item.'"');
391 0 $fmt = $self->append_format($fmt,'"'.$info.'"');
392 }
393 }
394 } else {
395 0 croak("Programmer error. list argument missing or not an array.")
396 }
397  
398 0 my $command = $self->prepare_command( $args, $fmt );
399  
400 0 ▶ if ($args->{'checklist'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args->{"checklist"}) 0 0 0
401 0 my ($rv,$selected) = $self->command_array($command);
402 0 $self->_post($args);
403 0 ▶ return($rv == 0 ? $selected : 0) unless defined wantarray and wantarray;
Branch: 2 branches
BranchTrueFalseTotal
unless defined wantarray and wantarray 0 0 0
$rv == 0 ? : 0 0 0
Condition0%0/3
defined wantarray and wantarray
!ll&&!rl&&r
000
MC/DC0%0/2
defined wantarray and wantarray
defined wantarray wantarray
Truth table0%0/3
A and B
A= defined wantarrayB= wantarray
ABresult
0X0
100
111
404 0 ▶ return($rv == 0 ? $self->ra() : (0));
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
405 }
406 0 my ($rv,$selected) = $self->command_string($command);
407 0 $self->_post($args);
408 0 ▶ return($rv == 0 ? $selected : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
409 }
410 sub menu {
411 0 ▶ my $self = shift();
Subroutine menu: not called CC=2 SCAR=17.9
Pod documented
412 0 ▶ return($self->list('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
413 }
414 sub checklist {
415 0 ▶ my $self = shift();
Subroutine checklist: not called CC=2 SCAR=17.9
Pod documented
416 0 ▶ return($self->list('caller',((caller(1))[3]||'main'),@_,'checklist',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
417 }
418 sub radiolist {
419 0 ▶ my $self = shift();
Subroutine radiolist: not called CC=2 SCAR=17.9
Pod documented
420 0 ▶ return($self->list('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
421 }
422  
423 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
424 #: file select
425 sub fselect {
426 0 ▶ my $self = shift();
Subroutine fselect: not called CC=10 SCAR=47.0
Pod documented
427 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
428 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
429 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
430 0 shift(); $caller = shift();
431 }
432 0 my $args = $self->_pre($caller,@_);
433  
434 0 ▶ my $filename = $args->{'path'} || $args->{'filename'} || abs_path();
Condition0%0/6
$args->{'path'} || $args->{'filename'} || abs_path()
l!l&&r!l&&!r
000
$args->{"path"} or $args->{"filename"}
l!l&&r!l&&!r
000
MC/DC0%0/3
$args->{'path'} || $args->{'filename'} || abs_path()
$args->{"path"} $args->{"filename"} abs_path()
Truth table0%0/4
A or B || C
A= $args->{"path"}B= $args->{"filename"}C= abs_path()
ABCresult
1XX1
01X1
0011
0000
435 0 $args->{'path'} = $filename;
436 0 ▶ $args->{'path'} = (-d $args->{'path'}) ? $args->{'path'}."/" : $args->{'path'};
Branch: 1 branch
BranchTrueFalseTotal
-d $args->{'path'} ? : 0 0 0
437 0 $args->{'path'} =~ s!/+!/!g;
438  
439 0 my $fmt = $self->prepare_format($args);
440 0 $fmt = $self->append_format_base($args,$fmt);
441 0 $fmt = $self->append_format($fmt,'--file-selection');
442 0 $fmt = $self->append_format($fmt,'--filename {{filename}}');
443 0 my $command = $self->prepare_command
444 ( $args, $fmt,
445 filename => $self->make_kvl($args,$filename)
446 );
447  
448 0 $self->_debug("fselect: ".$args->{'path'});
449 0 my ($rv,$file) = $self->command_string($command);
450 0 $self->_post($args);
451 0 ▶ return($rv == 0 ? $file : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
452 }
453  
454 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
455 #: directory select
456 sub dselect {
457 0 ▶ my $self = shift();
Subroutine dselect: not called CC=10 SCAR=47.0
Pod documented
458 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
459 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
460 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
461 0 shift(); $caller = shift();
462 }
463 0 my $args = $self->_pre($caller,@_);
464  
465 0 ▶ my $filename = $args->{'path'} || $args->{'filename'} || abs_path();
Condition0%0/6
$args->{'path'} || $args->{'filename'} || abs_path()
l!l&&r!l&&!r
000
$args->{"path"} or $args->{"filename"}
l!l&&r!l&&!r
000
MC/DC0%0/3
$args->{'path'} || $args->{'filename'} || abs_path()
$args->{"path"} $args->{"filename"} abs_path()
Truth table0%0/4
A or B || C
A= $args->{"path"}B= $args->{"filename"}C= abs_path()
ABCresult
1XX1
01X1
0011
0000
466 0 $args->{'path'} = $filename;
467 0 ▶ $args->{'path'} = (-d $args->{'path'}) ? $args->{'path'}."/" : $args->{'path'};
Branch: 1 branch
BranchTrueFalseTotal
-d $args->{'path'} ? : 0 0 0
468 0 $args->{'path'} =~ s!/+!/!g;
469  
470 0 my $fmt = $self->prepare_format($args);
471 0 $fmt = $self->append_format_base($args,$fmt);
472 0 $fmt = $self->append_format($fmt,'--file-selection --directory');
473 0 $fmt = $self->append_format($fmt,'--filename {{filename}}');
474 0 my $command = $self->prepare_command
475 ( $args, $fmt,
476 filename => $self->make_kvl($args,$filename)
477 );
478  
479 0 $self->_debug("fselect: ".$args->{'path'});
480 0 my ($rv,$file) = $self->command_string($command);
481 0 $self->_post($args);
482 0 ▶ return($rv == 0 ? $file : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
483 }
484  
485 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
486 #: calendar
487 sub calendar {
488 0 ▶ my $self = shift();
Subroutine calendar: not called CC=11 SCAR=48.8
Pod documented
489 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
490 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
491 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
492 0 shift(); $caller = shift();
493 }
494 0 my $args = $self->_pre($caller,@_);
495  
496 0 my $fmt = $self->prepare_format($args);
497 0 $fmt = $self->append_format_base($args,$fmt);
498 0 $fmt = $self->append_format($fmt,'--calendar');
499 0 $fmt = $self->append_format_check($args,$fmt,'text','--text {{text}}');
500 0 $fmt = $self->append_format_check($args,$fmt,'date-format','--date-format {{date-format}}');
501 0 $fmt = $self->append_format_check($args,$fmt,'day','--day {{day}}');
502 0 $fmt = $self->append_format_check($args,$fmt,'month','--month {{month}}');
503 0 $fmt = $self->append_format_check($args,$fmt,'year','--year {{year}}');
504 my $command = $self->prepare_command
505 ( $args, $fmt,
506 0 text => $self->make_kvt($args,$args->{'text'}),
507 );
508  
509 0 my ($rv,$date) = $self->command_string($command);
510 0 ▶ if ($rv == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rv == 0) 0 0 0
511 0 $self->ra(split(m!/!,$date));
512 }
513 0 $self->_post($args);
514 0 ▶ return($rv == 0 ? $date : 0) unless defined wantarray and wantarray;
Branch: 2 branches
BranchTrueFalseTotal
unless defined wantarray and wantarray 0 0 0
$rv == 0 ? : 0 0 0
Condition0%0/3
defined wantarray and wantarray
!ll&&!rl&&r
000
MC/DC0%0/2
defined wantarray and wantarray
defined wantarray wantarray
Truth table0%0/3
A and B
A= defined wantarrayB= wantarray
ABresult
0X0
100
111
515 0 ▶ return($rv == 0 ? $self->ra() : (0,0,0));
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
516 }
517  
518 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
519 #: progress
520  
521 sub gauge_start {
522 0 ▶ my $self = shift();
Subroutine gauge_start: not called CC=12 SCAR=50.5
Pod documented
523 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
524 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
525 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
526 0 shift(); $caller = shift();
527 }
528 0 my $args = $self->_pre($caller,@_);
529  
530 0 ▶ $self->{'_GAUGE'} ||= {};
Condition0%0/2
$self->{"_GAUGE"} ||= {}
l!l
00
MC/DC0%0/1
$self->{"_GAUGE"} ||= {}
$self->{"_GAUGE"}
Truth table0%0/2
A
A= $self->{"_GAUGE"}
Aresult
11
00
531 0 $self->{'_GAUGE'}->{'ARGS'} = $args;
532  
533 0 ▶ if (defined $self->{'_GAUGE'}->{'FH'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"_GAUGE"}{"FH"}) 0 0 0
534 0 $self->rv(129);
535 0 $self->_post($args);
536 0 return(0);
537 }
538  
539 0 my $fmt = $self->prepare_format($args);
540 0 $fmt = $self->append_format_base($args,$fmt);
541 0 $fmt = $self->append_format($fmt,'--progress');
542 0 $fmt = $self->append_format_check($args,$fmt,'pulsate','--pulsate');
543 0 $fmt = $self->append_format_check($args,$fmt,'text','--text {{text}}');
544 0 $fmt = $self->append_format($fmt,'--percentage {{percentage}}');
545 my $command = $self->prepare_command
546 ( $args, $fmt,
547 text => $self->make_kvt($args,$args->{'text'}),
548 0 ▶ percentage => $self->make_kvl($args,$args->{'percentage'}||'0'),
Condition0%0/2
$args->{'percentage'} || '0'
l!l
00
MC/DC0%0/1
$args->{'percentage'} || '0'
$args->{'percentage'}
Truth table0%0/2
A
A= $args->{'percentage'}
Aresult
11
00
549 );
550  
551 0 ▶ $self->{'_GAUGE'}->{'PERCENT'} = ($args->{'percentage'} || '0');
Condition0%0/2
$args->{'percentage'} || '0'
l!l
00
MC/DC0%0/1
$args->{'percentage'} || '0'
$args->{'percentage'}
Truth table0%0/2
A
A= $args->{'percentage'}
Aresult
11
00
552 0 $self->{'_GAUGE'}->{'FH'} = new FileHandle;
553 0 $self->{'_GAUGE'}->{'FH'}->open("| $command");
554 0 my $rv = ($? >> 8);
555 0 $self->{'_GAUGE'}->{'FH'}->autoflush(1);
556 0 ▶ $self->rv($rv||'null');
Condition0%0/2
$rv || 'null'
l!l
00
MC/DC0%0/1
$rv || 'null'
$rv
Truth table0%0/2
A
A= $rv
Aresult
11
00
557 0 $self->ra('null');
558 0 $self->rs('null');
559 0 ▶ return($rv == 0 ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
560 }
561 sub gauge_inc {
562 0 ▶ my $self = $_[0];
Subroutine gauge_inc: not called CC=4 SCAR=30.0
Pod documented
563 0 ▶ my $incr = $_[1] || 1;
Condition0%0/2
$_[1] || 1
l!l
00
MC/DC0%0/1
$_[1] || 1
$_[1]
Truth table0%0/2
A
A= $_[1]
Aresult
11
00
564  
565 0 ▶ return(0) unless defined $self->{'_GAUGE'}->{'FH'};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"_GAUGE"}{"FH"} 0 0 0
566  
567 0 my $fh = $self->{'_GAUGE'}->{'FH'};
568 0 $self->{'_GAUGE'}->{'PERCENT'} += $incr;
569 0 $SIG_CODE->{$$} = $self; local $SIG{'PIPE'} = \&_del_gauge;
570 0 print $fh $self->{'_GAUGE'}->{'PERCENT'}."\n";
571 0 ▶ return(((defined $self->{'_GAUGE'}->{'FH'}) ? 1 : 0));
Branch: 1 branch
BranchTrueFalseTotal
defined $self->{'_GAUGE'}{'FH'} ? : 0 0 0
572 }
573 sub gauge_dec {
574 0 ▶ my $self = $_[0];
Subroutine gauge_dec: not called CC=4 SCAR=30.0
Pod documented
575 0 ▶ my $decr = $_[1] || 1;
Condition0%0/2
$_[1] || 1
l!l
00
MC/DC0%0/1
$_[1] || 1
$_[1]
Truth table0%0/2
A
A= $_[1]
Aresult
11
00
576  
577 0 ▶ return(0) unless defined $self->{'_GAUGE'}->{'FH'};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"_GAUGE"}{"FH"} 0 0 0
578  
579 0 my $fh = $self->{'_GAUGE'}->{'FH'};
580 0 $self->{'_GAUGE'}->{'PERCENT'} -= $decr;
581 0 $SIG_CODE->{$$} = $self; local $SIG{'PIPE'} = \&_del_gauge;
582 0 print $fh $self->{'_GAUGE'}->{'PERCENT'}."\n";
583 0 ▶ return(((defined $self->{'_GAUGE'}->{'FH'}) ? 1 : 0));
Branch: 1 branch
BranchTrueFalseTotal
defined $self->{'_GAUGE'}{'FH'} ? : 0 0 0
584 }
585 sub gauge_set {
586 0 ▶ my $self = $_[0];
Subroutine gauge_set: not called CC=5 SCAR=34.0
Pod documented
587 0 ▶ my $perc = $_[1] || $self->{'_GAUGE'}->{'PERCENT'} || 1;
Condition0%0/5
$_[1] || $self->{'_GAUGE'}{'PERCENT'} || 1
l!l
00
$_[1] or $self->{"_GAUGE"}{"PERCENT"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$_[1] || $self->{'_GAUGE'}{'PERCENT'} || 1
$_[1] $self->{"_GAUGE"}{"PERCENT"}
Truth table0%0/3
A or B
A= $_[1]B= $self->{"_GAUGE"}{"PERCENT"}
ABresult
1X1
011
000
588  
589 0 ▶ return(0) unless $self->{'_GAUGE'}->{'FH'};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"_GAUGE"}{"FH"} 0 0 0
590  
591 0 my $fh = $self->{'_GAUGE'}->{'FH'};
592 0 $self->{'_GAUGE'}->{'PERCENT'} = $perc;
593 0 $SIG_CODE->{$$} = $self; local $SIG{'PIPE'} = \&_del_gauge;
594 0 print $fh $self->{'_GAUGE'}->{'PERCENT'}."\n";
595 0 ▶ return(((defined $self->{'_GAUGE'}->{'FH'}) ? 1 : 0));
Branch: 1 branch
BranchTrueFalseTotal
defined $self->{'_GAUGE'}{'FH'} ? : 0 0 0
596 }
597 #: Textual updates are not supported by Zenity...
598 sub gauge_text {
599 0 ▶ my $self = $_[0];
Subroutine gauge_text: not called CC=4 SCAR=30.0
Pod undocumented
600 0 ▶ my $mesg = $_[1] || return(0);
Condition0%0/2
$_[1] || (return 0)
l!l
00
MC/DC0%0/1
$_[1] || (return 0)
$_[1]
Truth table0%0/2
A
A= $_[1]
Aresult
11
00
601  
602 0 my $fh = $self->{'_GAUGE'};
603 0 ▶ return(0) unless $self->{'_GAUGE'};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"_GAUGE"} 0 0 0
604  
605 # $SIG_CODE->{$$} = $self; local $SIG{'PIPE'} = \&_del_gauge;
606 # print $fh "\nXXX\n\n".$mesg."\n\nXXX\n\n".$self->{'_GAUGE'}->{'PERCENT'}."\n";
607 0 ▶ return(((defined $self->{'_GAUGE'}) ? 1 : 0));
Branch: 1 branch
BranchTrueFalseTotal
defined $self->{'_GAUGE'} ? : 0 0 0
608 }
609 sub gauge_stop {
610 0 ▶ my $self = $_[0];
Subroutine gauge_stop: not called CC=4 SCAR=30.0
Pod documented
611 0 ▶ my $args = $self->{'_GUAGE'}->{'ARGS'} ||
Condition0%0/5
$self->{'_GUAGE'}{'ARGS'} || $self->_merge_attrs('title', 'gauge_stop', 'caller', (caller 1)[3] || 'main')
l!l&&r!l&&!r
000
(caller 1)[3] || 'main'
l!l
00
MC/DC0%0/2
$self->{'_GUAGE'}{'ARGS'} || $self->_merge_attrs('title', 'gauge_stop', 'caller', (caller 1)[3] || 'main')
$self->{'_GUAGE'}{'ARGS'} $self->_merge_attrs('title', 'gauge_stop', 'caller', (caller 1)[3] || 'main')
MC/DC0%0/1
(caller 1)[3] || 'main'
(caller 1)[3]
Truth table0%0/3
A || B
A= $self->{'_GUAGE'}{'ARGS'}B= $self->_merge_attrs('title', 'gauge_stop', 'caller', (caller 1)[3] || 'main')
ABresult
1X1
011
000
Truth table0%0/2
A
A= (caller 1)[3]
Aresult
11
00
612 $self->_merge_attrs( title => 'gauge_stop',
613 'caller' => ((caller(1))[3]||'main') );
614  
615 0 ▶ unless ($self->{'_GAUGE'}->{'FH'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"_GAUGE"}{"FH"}) 0 0 0
616 0 $self->rv(129);
617 0 $self->_post($args);
618 0 return(0);
619 }
620  
621 0 my $fh = $self->{'_GAUGE'}->{'FH'};
622 0 $SIG_CODE->{$$} = $self; local $SIG{'PIPE'} = \&_del_gauge;
623 0 $self->{'_GAUGE'}->{'FH'}->close();
624 0 delete($self->{'_GAUGE'}->{'ARGS'});
625 0 delete($self->{'_GAUGE'}->{'FH'});
626 0 delete($self->{'_GAUGE'}->{'PERCENT'});
627 0 delete($self->{'_GAUGE'});
628 0 $self->rv('null');
629 0 $self->rs('null');
630 0 $self->ra('null');
631 0 $self->_post($args);
632 0 return(1);
633 }
634  
635 2 1;
636  
« Dialog/Backend/Whiptail.pm ↑ Summary Dialog/GNOME.pm »