Dialog/Backend/CDialog.pm

filter: Statementstmt 11.2% 65 / 579 Branchbran 3.1% 7 / 220 Conditioncond 6.7% 20 / 298 MC/DCmcdc 0.0% 0 / 163 Subroutinesub 30.0% 12 / 40 Podpod 87.5% 21 / 24 totaltotal 9.4% 125 / 1324 CC 242 SCAR 59.2
CC
242
Cov
8%
new
1191.8
_organize_text
506.0
msgbox
240.0
CRAP 372.0
« Dialog.pm ↑ Summary Dialog/Backend.pm »
1 package UI::Dialog::Backend::CDialog;
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 6 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 6 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 6 ▶use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 6 ▶use FileHandle;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 6 ▶use Cwd qw( abs_path );
Subroutine BEGIN: called CC=1 SCAR=0.0
26 6 ▶use Time::HiRes qw( sleep );
Subroutine BEGIN: called CC=1 SCAR=0.0
27 6 ▶use UI::Dialog::Backend;
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 BEGIN {
30 6 ▶ use vars qw( $VERSION @ISA );
Subroutine BEGIN: called CC=1 SCAR=0.0
31 6 ▶ @ISA = qw( UI::Dialog::Backend );
Subroutine BEGIN: called CC=1 SCAR=0.0
32 6 $VERSION = '1.20';
33 }
34  
35 #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
36 #: Constructor Method
37 #:
38  
39 sub new {
40 1 ▶ my $proto = shift();
Subroutine new: called CC=59 SCAR=70.8
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 $path_sep = $Config::Config{path_sep};
50 1 my $CFG_PATH = $cfg->{'PATH'};
51 1 ▶ if ($CFG_PATH) {
Branch: 2 branches
BranchTrueFalseTotal
if ($CFG_PATH) { } 0 1 1
elsif ($ENV{'PATH'}) { } 1 0 1
52 0 ▶ if (ref($CFG_PATH) eq "ARRAY") {
Branch: 3 branches
BranchTrueFalseTotal
if (ref $CFG_PATH eq 'ARRAY') { } 0 0 0
elsif ($CFG_PATH =~ /$path_sep/) { } 0 0 0
elsif (-d $CFG_PATH) { } 0 0 0
53 0 $self->{'PATHS'} = $CFG_PATH;
54 }
55 elsif ($CFG_PATH =~ m!$path_sep!) {
56 0 $self->{'PATHS'} = [ split(/$path_sep/,$CFG_PATH) ];
57 }
58 elsif (-d $CFG_PATH) {
59 0 $self->{'PATHS'} = [ $CFG_PATH ];
60 }
61 }
62 elsif ($ENV{'PATH'}) {
63 1 $self->{'PATHS'} = [ split(/$path_sep/,$ENV{'PATH'}) ];
64 }
65 else {
66 0 $self->{'PATHS'} = '';
67 }
68  
69 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
70 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
71 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
72 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
73 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
74 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
75 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
76 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
77 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
78 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
79 1 ▶ $self->{'_opts'}->{'colours'} = ($cfg->{'colours'} || $cfg->{'colors'}) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$cfg->{'colours'} || $cfg->{'colors'} ? : 0 1 1
Condition33%1/3
$cfg->{"colours"} or $cfg->{"colors"}
l!l&&r!l&&!r
001
MC/DC0%0/2
$cfg->{"colours"} or $cfg->{"colors"}
$cfg->{"colours"} $cfg->{"colors"}
Truth table33%1/3
A or B
A= $cfg->{"colours"}B= $cfg->{"colors"}
ABresult
1X1
011
000
80 1 ▶ $self->{'_opts'}->{'bin'} ||= $self->_find_bin('dialog');
Condition33%1/3
$self->{"_opts"}{"bin"} ||= $self->_find_bin("dialog")
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->{"_opts"}{"bin"} ||= $self->_find_bin("dialog")
$self->{"_opts"}{"bin"} $self->_find_bin("dialog")
Truth table33%1/3
A ||= B
A= $self->{"_opts"}{"bin"}B= $self->_find_bin("dialog")
ABresult
1X1
011
000
81 1 ▶ $self->{'_opts'}->{'bin'} ||= $self->_find_bin('dialog.exe') if $^O =~ /win32/i;
Branch: 1 branch
BranchTrueFalseTotal
if $^O =~ /win32/i 0 1 1
Condition0%0/3
$self->{"_opts"}{"bin"} ||= $self->_find_bin("dialog.exe")
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"_opts"}{"bin"} ||= $self->_find_bin("dialog.exe")
$self->{"_opts"}{"bin"} $self->_find_bin("dialog.exe")
Truth table0%0/3
A ||= B
A= $self->{"_opts"}{"bin"}B= $self->_find_bin("dialog.exe")
ABresult
1X1
011
000
82 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
83 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
84 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
85 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
86 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
87 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
88 1 ▶ unless (-x $self->{'_opts'}->{'bin'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-x $self->{"_opts"}{"bin"}) 1 0 1
89 1 croak("the dialog binary could not be found at: ".$self->{'_opts'}->{'bin'});
90 }
91 0 ▶ $self->{'_opts'}->{'DIALOGRC'} = $cfg->{'DIALOGRC'} || undef();
Condition0%0/2
$cfg->{'DIALOGRC'} || undef()
l!l
00
MC/DC0%0/1
$cfg->{'DIALOGRC'} || undef()
$cfg->{'DIALOGRC'}
Truth table0%0/2
A
A= $cfg->{'DIALOGRC'}
Aresult
11
00
92 0 my $beginref = $cfg->{'begin'};
93 0 ▶ $self->{'_opts'}->{'begin'} = (ref($beginref) eq "ARRAY") ? $beginref : undef();
Branch: 1 branch
BranchTrueFalseTotal
ref $beginref eq 'ARRAY' ? : 0 0 0
94 0 ▶ $self->{'_opts'}->{'cancel-label'} = $cfg->{'cancel-label'} || undef();
Condition0%0/2
$cfg->{'cancel-label'} || undef()
l!l
00
MC/DC0%0/1
$cfg->{'cancel-label'} || undef()
$cfg->{'cancel-label'}
Truth table0%0/2
A
A= $cfg->{'cancel-label'}
Aresult
11
00
95 0 ▶ $self->{'_opts'}->{'defaultno'} = $cfg->{'defaultno'} || 0;
Condition0%0/2
$cfg->{'defaultno'} || 0
l!l
00
MC/DC0%0/1
$cfg->{'defaultno'} || 0
$cfg->{'defaultno'}
Truth table0%0/2
A
A= $cfg->{'defaultno'}
Aresult
11
00
96 0 ▶ $self->{'_opts'}->{'default-item'} = $cfg->{'default-item'} || undef();
Condition0%0/2
$cfg->{'default-item'} || undef()
l!l
00
MC/DC0%0/1
$cfg->{'default-item'} || undef()
$cfg->{'default-item'}
Truth table0%0/2
A
A= $cfg->{'default-item'}
Aresult
11
00
97 0 ▶ $self->{'_opts'}->{'exit-label'} = $cfg->{'exit-label'} || undef();
Condition0%0/2
$cfg->{'exit-label'} || undef()
l!l
00
MC/DC0%0/1
$cfg->{'exit-label'} || undef()
$cfg->{'exit-label'}
Truth table0%0/2
A
A= $cfg->{'exit-label'}
Aresult
11
00
98 0 ▶ $self->{'_opts'}->{'extra-button'} = $cfg->{'extra-button'} || 0;
Condition0%0/2
$cfg->{'extra-button'} || 0
l!l
00
MC/DC0%0/1
$cfg->{'extra-button'} || 0
$cfg->{'extra-button'}
Truth table0%0/2
A
A= $cfg->{'extra-button'}
Aresult
11
00
99 0 ▶ $self->{'_opts'}->{'extra-label'} = $cfg->{'extra-label'} || undef();
Condition0%0/2
$cfg->{'extra-label'} || undef()
l!l
00
MC/DC0%0/1
$cfg->{'extra-label'} || undef()
$cfg->{'extra-label'}
Truth table0%0/2
A
A= $cfg->{'extra-label'}
Aresult
11
00
100 0 ▶ $self->{'_opts'}->{'help-button'} = $cfg->{'help-button'} || 0;
Condition0%0/2
$cfg->{'help-button'} || 0
l!l
00
MC/DC0%0/1
$cfg->{'help-button'} || 0
$cfg->{'help-button'}
Truth table0%0/2
A
A= $cfg->{'help-button'}
Aresult
11
00
101 0 ▶ $self->{'_opts'}->{'help-label'} = $cfg->{'help-label'} || undef();
Condition0%0/2
$cfg->{'help-label'} || undef()
l!l
00
MC/DC0%0/1
$cfg->{'help-label'} || undef()
$cfg->{'help-label'}
Truth table0%0/2
A
A= $cfg->{'help-label'}
Aresult
11
00
102 0 ▶ $self->{'_opts'}->{'max-input'} = $cfg->{'max-input'} || 0;
Condition0%0/2
$cfg->{'max-input'} || 0
l!l
00
MC/DC0%0/1
$cfg->{'max-input'} || 0
$cfg->{'max-input'}
Truth table0%0/2
A
A= $cfg->{'max-input'}
Aresult
11
00
103 0 ▶ $self->{'_opts'}->{'no-cancel'} = $cfg->{'no-cancel'} || $cfg->{'nocancel'} || 0;
Condition0%0/5
$cfg->{'no-cancel'} || $cfg->{'nocancel'} || 0
l!l
00
$cfg->{"no-cancel"} or $cfg->{"nocancel"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$cfg->{'no-cancel'} || $cfg->{'nocancel'} || 0
$cfg->{"no-cancel"} $cfg->{"nocancel"}
Truth table0%0/3
A or B
A= $cfg->{"no-cancel"}B= $cfg->{"nocancel"}
ABresult
1X1
011
000
104 0 ▶ $self->{'_opts'}->{'no-collapse'} = $cfg->{'no-collapse'} || 0;
Condition0%0/2
$cfg->{'no-collapse'} || 0
l!l
00
MC/DC0%0/1
$cfg->{'no-collapse'} || 0
$cfg->{'no-collapse'}
Truth table0%0/2
A
A= $cfg->{'no-collapse'}
Aresult
11
00
105 0 ▶ $self->{'_opts'}->{'no-shadow'} = $cfg->{'no-shadow'} || 0;
Condition0%0/2
$cfg->{'no-shadow'} || 0
l!l
00
MC/DC0%0/1
$cfg->{'no-shadow'} || 0
$cfg->{'no-shadow'}
Truth table0%0/2
A
A= $cfg->{'no-shadow'}
Aresult
11
00
106 0 ▶ $self->{'_opts'}->{'ok-label'} = $cfg->{'ok-label'} || undef();
Condition0%0/2
$cfg->{'ok-label'} || undef()
l!l
00
MC/DC0%0/1
$cfg->{'ok-label'} || undef()
$cfg->{'ok-label'}
Truth table0%0/2
A
A= $cfg->{'ok-label'}
Aresult
11
00
107 0 ▶ $self->{'_opts'}->{'shadow'} = $cfg->{'shadow'} || 0;
Condition0%0/2
$cfg->{'shadow'} || 0
l!l
00
MC/DC0%0/1
$cfg->{'shadow'} || 0
$cfg->{'shadow'}
Truth table0%0/2
A
A= $cfg->{'shadow'}
Aresult
11
00
108 0 ▶ $self->{'_opts'}->{'tab-correct'} = $cfg->{'tab-correct'} || 0;
Condition0%0/2
$cfg->{'tab-correct'} || 0
l!l
00
MC/DC0%0/1
$cfg->{'tab-correct'} || 0
$cfg->{'tab-correct'}
Truth table0%0/2
A
A= $cfg->{'tab-correct'}
Aresult
11
00
109 0 ▶ $self->{'_opts'}->{'tab-len'} = $cfg->{'tab-len'} || 0;
Condition0%0/2
$cfg->{'tab-len'} || 0
l!l
00
MC/DC0%0/1
$cfg->{'tab-len'} || 0
$cfg->{'tab-len'}
Truth table0%0/2
A
A= $cfg->{'tab-len'}
Aresult
11
00
110 0 ▶ $self->{'_opts'}->{'listheight'} = $cfg->{'listheight'} || $cfg->{'menuheight'} || 5;
Condition0%0/5
$cfg->{'listheight'} || $cfg->{'menuheight'} || 5
l!l
00
$cfg->{"listheight"} or $cfg->{"menuheight"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$cfg->{'listheight'} || $cfg->{'menuheight'} || 5
$cfg->{"listheight"} $cfg->{"menuheight"}
Truth table0%0/3
A or B
A= $cfg->{"listheight"}B= $cfg->{"menuheight"}
ABresult
1X1
011
000
111 0 ▶ $self->{'_opts'}->{'formheight'} = $cfg->{'formheight'} || $cfg->{'listheight'} || 5;
Condition0%0/5
$cfg->{'formheight'} || $cfg->{'listheight'} || 5
l!l
00
$cfg->{"formheight"} or $cfg->{"listheight"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$cfg->{'formheight'} || $cfg->{'listheight'} || 5
$cfg->{"formheight"} $cfg->{"listheight"}
Truth table0%0/3
A or B
A= $cfg->{"formheight"}B= $cfg->{"listheight"}
ABresult
1X1
011
000
112 0 ▶ $self->{'_opts'}->{'yes-label'} = $cfg->{'yes-label'} || undef();
Condition0%0/2
$cfg->{'yes-label'} || undef()
l!l
00
MC/DC0%0/1
$cfg->{'yes-label'} || undef()
$cfg->{'yes-label'}
Truth table0%0/2
A
A= $cfg->{'yes-label'}
Aresult
11
00
113 0 ▶ $self->{'_opts'}->{'no-label'} = $cfg->{'no-label'} || undef();
Condition0%0/2
$cfg->{'no-label'} || undef()
l!l
00
MC/DC0%0/1
$cfg->{'no-label'} || undef()
$cfg->{'no-label'}
Truth table0%0/2
A
A= $cfg->{'no-label'}
Aresult
11
00
114  
115 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
116  
117 0 $self->_determine_dialog_variant();
118  
119 0 ▶ $self->{'test_mode'} = $cfg->{'test_mode'} if exists $cfg->{'test_mode'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $cfg->{"test_mode"} 0 0 0
120 0 $self->{'test_mode_result'} = '';
121  
122 0 return($self);
123 }
124  
125 #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
126 #: Private Methods
127 #:
128 sub _determine_dialog_variant {
129 0 ▶ my $self = $_[0];
Subroutine _determine_dialog_variant: not called CC=4 SCAR=30.0
130 0 my $str = `$self->{'_opts'}->{'bin'} --help 2>&1`;
131 0 ▶ if ($str =~ /version\s0\.[34]/m) {
Branch: 2 branches
BranchTrueFalseTotal
if ($str =~ /version\s0\.[34]/m) { } 0 0 0
elsif ($str =~ /cdialog\s\(ComeOn\sDialog\!\)\sversion\s(\d+\.\d+.+)/) { } 0 0 0
132 # this version does not support colours, so far just FreeBSD 4.8 has this
133 # ancient binary. Bugreport from Jeroen Bulten indicates that he's
134 # got a version 0.3 (patched to 0.4) installed. ugh...
135 0 $self->{'_variant'} = "dialog";
136 # the separate-output option seems to be the culprit of FreeBSD failure.
137 0 $self->{'_opts'}->{'force-no-separate-output'} = 1;
138 }
139 elsif ($str =~ /cdialog\s\(ComeOn\sDialog\!\)\sversion\s(\d+\.\d+.+)/) {
140 # We consider cdialog to be a colour supporting dialog variant all others
141 # are non-colourized and support only the base functionality :(
142 0 my $ver = $1;
143 0 ▶ if ($ver =~ /-20(?:0[3-9]|\d\d)/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ver =~ /-20(?:0[3-9]|\d\d)/) { } 0 0 0
144 0 $self->{'_variant'} = "cdialog";
145 # these versions support colours :)
146 0 $self->{'_opts'}->{'colours'} = 1;
147 }
148 else {
149 0 $self->{'_variant'} = "dialog";
150 }
151 }
152 else {
153 0 $self->{'_variant'} = "dialog";
154 }
155 0 undef($str);
156 }
157  
158 6 my $SIG_CODE = {};
159 sub _del_gauge {
160 0 ▶ my $CODE = $SIG_CODE->{$$};
Subroutine _del_gauge: not called CC=2 SCAR=17.9
161 0 ▶ unless (not ref($CODE)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (not ref $CODE) 0 0 0
162 0 delete($CODE->{'_GAUGE'});
163 0 $CODE->rv('1');
164 0 $CODE->rs('null');
165 0 $CODE->ra('null');
166 0 $SIG_CODE->{$$} = "";
167 }
168 }
169  
170 sub append_format_base {
171 0 ▶ my ($self,$args,$fmt) = @_;
Subroutine append_format_base: not called CC=8 SCAR=42.8
Pod undocumented
172 0 ▶ $ENV{'DIALOGRC'} ||= ($args->{'DIALOGRC'} && -r $args->{'DIALOGRC'}) ? $args->{'DIALOGRC'} : "";
Branch: 1 branch
BranchTrueFalseTotal
$args->{'DIALOGRC'} && -r $args->{'DIALOGRC'} ? : 0 0 0
Condition0%0/6
$ENV{"DIALOGRC"} ||= $args->{"DIALOGRC"} && -r $args->{"DIALOGRC"} ? $args->{"DIALOGRC"} : ""
l!l&&r!l&&!r
000
$args->{"DIALOGRC"} and -r $args->{"DIALOGRC"}
!ll&&!rl&&r
000
MC/DC0%0/3
$ENV{"DIALOGRC"} ||= $args->{"DIALOGRC"} && -r $args->{"DIALOGRC"} ? $args->{"DIALOGRC"} : ""
$ENV{"DIALOGRC"} $args->{"DIALOGRC"} -r $args->{"DIALOGRC"}
Truth table0%0/4
A ||= B and C
A= $ENV{"DIALOGRC"}B= $args->{"DIALOGRC"}C= -r $args->{"DIALOGRC"}
ABCresult
1XX1
0111
00X0
0100
173 0 $ENV{'DIALOG_CANCEL'} = '1';
174 0 $ENV{'DIALOG_ERROR'} = '254';
175 0 $ENV{'DIALOG_ESC'} = '255';
176 0 $ENV{'DIALOG_EXTRA'} = '3';
177 0 $ENV{'DIALOG_HELP'} = '2';
178 0 $ENV{'DIALOG_OK'} = '0';
179 0 $fmt = $self->append_format_check($args,$fmt,'backtitle','--backtitle {{backtitle}}');
180 0 $fmt = $self->append_format_check($args,$fmt,"defaultno","--defaultno");
181 0 $fmt = $self->append_format_check($args,$fmt,"extra-button","--extra-button");
182 0 $fmt = $self->append_format_check($args,$fmt,"help-button","--help-button");
183 0 $fmt = $self->append_format_check($args,$fmt,"no-cancel","--no-cancel");
184 0 $fmt = $self->append_format_check($args,$fmt,"no-collapse","--no-collapse");
185 0 $fmt = $self->append_format_check($args,$fmt,"no-shadow","--no-shadow");
186 0 $fmt = $self->append_format_check($args,$fmt,"shadow","--shadow");
187 0 $fmt = $self->append_format_check($args,$fmt,"tab-correct","--tab-correct");
188 0 $fmt = $self->append_format_check($args,$fmt,"cancel-label","--cancel-label {{cancel-label}}");
189 0 $fmt = $self->append_format_check($args,$fmt,"default-item","--default-item {{default-item}}");
190 0 $fmt = $self->append_format_check($args,$fmt,"exit-label","--exit-label {{exit-label}}");
191 0 $fmt = $self->append_format_check($args,$fmt,"extra-label","--extra-label {{extra-label}}");
192 0 $fmt = $self->append_format_check($args,$fmt,"help-label","--help-label {{help-label}}");
193 0 $fmt = $self->append_format_check($args,$fmt,"max-input","--max-input {{max-input}}");
194 0 $fmt = $self->append_format_check($args,$fmt,"ok-label","--ok-label {{ok-label}}");
195 0 $fmt = $self->append_format_check($args,$fmt,"tab-len","--tab-len {{tab-len}}");
196 0 $fmt = $self->append_format_check($args,$fmt,"yes-label","--yes-label {{yes-label}}");
197 0 $fmt = $self->append_format_check($args,$fmt,"no-label","--no-label {{no-label}}");
198  
199 0 ▶ if ($self->{'_opts'}->{'force-no-separate-output'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_opts'}{'force-no-separate-output'}) { } 0 0 0
200 0 delete $args->{'separate-output'};
201 } else {
202 0 $fmt = $self->append_format_check($args,$fmt,"separate-output","--separate-output");
203 }
204 0 ▶ if ($self->is_cdialog()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->is_cdialog) 0 0 0
205 0 $fmt = $self->append_format($fmt,'--colors');
206 0 $fmt = $self->append_format($fmt,'--cr-wrap');
207 0 ▶ if (exists $args->{'begin'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args->{"begin"}) 0 0 0
208 0 my $begin = $args->{'begin'};
209 0 ▶ if (ref($begin) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $begin eq "ARRAY") 0 0 0
210 0 $fmt = $self->append_format($fmt,'--begin '.$begin->[0].' '.$begin->[1]);
211 }
212 }
213 }
214 0 return $fmt;
215 }
216  
217 #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
218 #: Override Inherited Methods
219 #:
220 sub _organize_text {
221 0 ▶ my $self = $_[0];
Subroutine _organize_text: not called CC=22 SCAR=62.3
222 0 ▶ my $text = $_[1] || return();
Condition0%0/2
$_[1] || (return ())
l!l
00
MC/DC0%0/1
$_[1] || (return ())
$_[1]
Truth table0%0/2
A
A= $_[1]
Aresult
11
00
223 0 ▶ my $width = $_[2] || 65;
Condition0%0/2
$_[2] || 65
l!l
00
MC/DC0%0/1
$_[2] || 65
$_[2]
Truth table0%0/2
A
A= $_[2]
Aresult
11
00
224 0 ▶ my $trust = (exists $_[3] && defined $_[3]) ? $_[3] : '0';
Branch: 1 branch
BranchTrueFalseTotal
exists $_[3] && defined $_[3] ? : 0 0 0
Condition0%0/3
exists $_[3] and defined $_[3]
!ll&&!rl&&r
000
MC/DC0%0/2
exists $_[3] and defined $_[3]
exists $_[3] defined $_[3]
Truth table0%0/3
A and B
A= exists $_[3]B= defined $_[3]
ABresult
0X0
100
111
225 0 my @array;
226  
227 0 ▶ if (ref($text) eq "ARRAY") {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $text eq 'ARRAY') { } 0 0 0
elsif ($text =~ /\\n/) { } 0 0 0
228 0 push(@array,@{$text});
229 }
230 elsif ($text =~ /\\n/) {
231 0 @array = split(/\\n/,$text);
232 }
233 else {
234 0 @array = split(/\n/,$text);
235 }
236 0 $text = undef();
237  
238 0 @array = $self->word_wrap($width,"","",@array);
239 0 my $max = @array;
240 0 ▶ for (my $i = 0; $i < $max; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $max) 0 0 0
241 0 $self->clean_format($trust,\$array[$i]);
242 }
243  
244 0 ▶ if ($self->{'scale'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"scale"}) 0 0 0
245 0 foreach my $line (@array) {
246 0 my $s_line = $line; #$self->__TRANSLATE_CLEAN($line);
247 0 $s_line =~ s!\[A\=\w+\]!!gi;
248 $self->{'width'} = length($s_line) + 5
249 if ($self->{'width'} - 5) < length($s_line)
250 0 ▶ && (length($s_line) <= $self->{'max-scale'});
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"width"} - 5 < length $s_line and length $s_line <= $self->{"max-scale"} 0 0 0
Condition0%0/3
$self->{"width"} - 5 < length $s_line and length $s_line <= $self->{"max-scale"}
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"width"} - 5 < length $s_line and length $s_line <= $self->{"max-scale"}
$self->{"width"} - 5 < length $s_line length $s_line <= $self->{"max-scale"}
Truth table0%0/3
A and B
A= $self->{"width"} - 5 < length $s_lineB= length $s_line <= $self->{"max-scale"}
ABresult
0X0
100
111
251 }
252 }
253  
254 0 ▶ my $new_line = $^O =~ /win32/i ? '\n' : "\n";
Branch: 1 branch
BranchTrueFalseTotal
$^O =~ /win32/i ? : 0 0 0
255 0 foreach my $line (@array) {
256 0 my $pad;
257 0 my $s_line = $self->_strip_text($line);
258 0 ▶ if ($line =~ /\[A\=(\w+)\]/i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /\[A\=(\w+)\]/i) 0 0 0
259 0 my $align = $1;
260 0 $line =~ s!\[A\=\w+\]!!gi;
261 0 ▶ if (uc($align) eq "CENTER" || uc($align) eq "C") {
Branch: 3 branches
BranchTrueFalseTotal
if (uc $align eq 'CENTER' or uc $align eq 'C') { } 0 0 0
elsif (uc $align eq 'LEFT' or uc $align eq 'L') { } 0 0 0
elsif (uc $align eq 'RIGHT' or uc $align eq 'R') { } 0 0 0
Condition0%0/3
uc $align eq "CENTER" or uc $align eq "C"
l!l&&r!l&&!r
000
MC/DC0%0/2
uc $align eq "CENTER" or uc $align eq "C"
uc $align eq "CENTER" uc $align eq "C"
Truth table0%0/3
A or B
A= uc $align eq "CENTER"B= uc $align eq "C"
ABresult
1X1
011
000
262 0 $pad = ((($self->{'_opts'}->{'width'} - 5) - length($s_line)) / 2);
263 }
264 ▶ elsif (uc($align) eq "LEFT" || uc($align) eq "L") {
Condition0%0/3
uc $align eq "LEFT" or uc $align eq "L"
l!l&&r!l&&!r
000
MC/DC0%0/2
uc $align eq "LEFT" or uc $align eq "L"
uc $align eq "LEFT" uc $align eq "L"
Truth table0%0/3
A or B
A= uc $align eq "LEFT"B= uc $align eq "L"
ABresult
1X1
011
000
265 0 $pad = 0;
266 }
267 ▶ elsif (uc($align) eq "RIGHT" || uc($align) eq "R") {
Condition0%0/3
uc $align eq "RIGHT" or uc $align eq "R"
l!l&&r!l&&!r
000
MC/DC0%0/2
uc $align eq "RIGHT" or uc $align eq "R"
uc $align eq "RIGHT" uc $align eq "R"
Truth table0%0/3
A or B
A= uc $align eq "RIGHT"B= uc $align eq "R"
ABresult
1X1
011
000
268 0 $pad = (($self->{'_opts'}->{'width'} - 5) - length($s_line));
269 }
270 }
271 0 ▶ if ($pad) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pad) { } 0 0 0
272 0 $text .= (" " x $pad).$new_line;
273 }
274 else {
275 0 $text .= $line . $new_line;
276 }
277 }
278 0 chomp($text);
279 0 return($self->_filter_text($text));
280 }
281 sub _strip_text {
282 0 ▶ my $self = shift();
Subroutine _strip_text: not called CC=1 SCAR=6.9
283 0 my $text = shift();
284 0 $text =~ s!\\Z0!!gmi;
285 0 $text =~ s!\\Z1!!gmi;
286 0 $text =~ s!\\Z2!!gmi;
287 0 $text =~ s!\\Z3!!gmi;
288 0 $text =~ s!\\Z4!!gmi;
289 0 $text =~ s!\\Z5!!gmi;
290 0 $text =~ s!\\Z6!!gmi;
291 0 $text =~ s!\\Z7!!gmi;
292 0 $text =~ s!\\Zb!!gmi;
293 0 $text =~ s!\\ZB!!gmi;
294 0 $text =~ s!\\Zu!!gmi;
295 0 $text =~ s!\\ZU!!gmi;
296 0 $text =~ s!\\Zr!!gmi;
297 0 $text =~ s!\\ZR!!gmi;
298 0 $text =~ s!\\Zn!!gmi;
299 0 $text =~ s!\[C=black\]!!gmi;
300 0 $text =~ s!\[C=red\]!!gmi;
301 0 $text =~ s!\[C=green\]!!gmi;
302 0 $text =~ s!\[C=yellow\]!!gmi;
303 0 $text =~ s!\[C=blue\]!!gmi;
304 0 $text =~ s!\[C=magenta\]!!gmi;
305 0 $text =~ s!\[C=cyan\]!!gmi;
306 0 $text =~ s!\[C=white\]!!gmi;
307 0 $text =~ s!\[B\]!!gmi;
308 0 $text =~ s!\[/B\]!!gmi;
309 0 $text =~ s!\[U\]!!gmi;
310 0 $text =~ s!\[/U\]!!gmi;
311 0 $text =~ s!\[R\]!!gmi;
312 0 $text =~ s!\[/R\]!!gmi;
313 0 $text =~ s!\[N\]!!gmi;
314 0 $text =~ s!\[A=\w+\]!!gmi;
315 0 return($text);
316 }
317 sub _filter_text {
318 0 ▶ my $self = shift();
Subroutine _filter_text: not called CC=4 SCAR=30.0
319 0 ▶ my $text = shift() || return();
Condition0%0/2
shift() || (return ())
l!l
00
MC/DC0%0/1
shift() || (return ())
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
320 0 ▶ if ($self->is_cdialog() && $self->{'_opts'}->{'colours'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->is_cdialog and $self->{'_opts'}{'colours'}) { } 0 0 0
Condition0%0/3
$self->is_cdialog and $self->{"_opts"}{"colours"}
!ll&&!rl&&r
000
MC/DC0%0/2
$self->is_cdialog and $self->{"_opts"}{"colours"}
$self->is_cdialog $self->{"_opts"}{"colours"}
Truth table0%0/3
A and B
A= $self->is_cdialogB= $self->{"_opts"}{"colours"}
ABresult
0X0
100
111
321 0 $text =~ s!\[C=black\]!\\Z0!gmi;
322 0 $text =~ s!\[C=red\]!\\Z1!gmi;
323 0 $text =~ s!\[C=green\]!\\Z2!gmi;
324 0 $text =~ s!\[C=yellow\]!\\Z3!gmi;
325 0 $text =~ s!\[C=blue\]!\\Z4!gmi;
326 0 $text =~ s!\[C=magenta\]!\\Z5!gmi;
327 0 $text =~ s!\[C=cyan\]!\\Z6!gmi;
328 0 $text =~ s!\[C=white\]!\\Z7!gmi;
329 0 $text =~ s!\[B\]!\\Zb!gmi;
330 0 $text =~ s!\[/B\]!\\ZB!gmi;
331 0 $text =~ s!\[U\]!\\Zu!gmi;
332 0 $text =~ s!\[/U\]!\\ZU!gmi;
333 0 $text =~ s!\[R\]!\\Zr!gmi;
334 0 $text =~ s!\[/R\]!\\ZR!gmi;
335 0 $text =~ s!\[N\]!\\Zn!gmi;
336 0 $text =~ s!\[A=\w+\]!!gmi;
337 0 return($text);
338 }
339 else {
340 0 return($self->_strip_text($text));
341 }
342 }
343  
344  
345 #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
346 #: Public Methods
347 #:
348  
349 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
350 #: test for the good stuff
351 sub is_cdialog {
352 0 ▶ my $self = $_[0];
Subroutine is_cdialog: not called CC=3 SCAR=24.8
Pod undocumented
353 0 ▶ return(1) if $self->{'_variant'} && $self->{'_variant'} eq "cdialog";
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_variant"} and $self->{"_variant"} eq "cdialog" 0 0 0
Condition0%0/3
$self->{"_variant"} and $self->{"_variant"} eq "cdialog"
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"_variant"} and $self->{"_variant"} eq "cdialog"
$self->{"_variant"} $self->{"_variant"} eq "cdialog"
Truth table0%0/3
A and B
A= $self->{"_variant"}B= $self->{"_variant"} eq "cdialog"
ABresult
0X0
100
111
354 0 return(0);
355 }
356  
357 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
358 #: Ask a binary question (Yes/No)
359 sub yesno {
360 0 ▶ my $self = shift();
Subroutine yesno: not called CC=9 SCAR=45.0
Pod documented
361 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
362 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
363 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
364 0 shift(); $caller = shift();
365 }
366 0 my $args = $self->_pre($caller,@_);
367  
368 0 my $fmt = $self->prepare_format($args);
369 0 $fmt = $self->append_format_base($args,$fmt);
370 0 $fmt = $self->append_format($fmt,'--yesno {{text}} {{height}} {{width}}');
371 my $command = $self->prepare_command
372 ( $args, $fmt,
373 0 text => $self->make_kvt($args,$args->{'text'}),
374 );
375  
376 0 my $rv = $self->command_state($command);
377 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
378 0 $self->ra("NO");
379 0 $self->rs("NO");
380 0 $self->rv($rv);
381 }
382 else {
383 0 $self->ra("YES");
384 0 $self->rs("YES");
385 0 $self->rv('null');
386 }
387 0 $self->_post($args);
388 0 ▶ return($rv == 0 ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
389 }
390  
391 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
392 #: Text entry
393 sub inputbox {
394 0 ▶ my $self = shift();
Subroutine inputbox: not called CC=10 SCAR=47.0
Pod documented
395 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
396 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
397 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
398 0 shift(); $caller = shift();
399 }
400 0 my $args = $self->_pre($caller,@_);
401  
402 0 my $fmt = $self->prepare_format($args);
403 0 $fmt = $self->append_format_base($args,$fmt);
404 0 ▶ if ($args->{'password'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args->{'password'}) { } 0 0 0
405 0 ▶ if ($args->{'entry'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args->{'entry'}) { } 0 0 0
406 0 $fmt = $self->append_format($fmt,'--insecure');
407 } else {
408 0 $fmt = $self->append_format_check($args,$fmt,'insecure','--insecure');
409 }
410 0 $fmt = $self->append_format($fmt,'--passwordbox');
411 }
412 else {
413 0 $fmt = $self->append_format($fmt,'--inputbox');
414 }
415 0 $fmt = $self->append_format($fmt,'{{text}} {{height}} {{width}} {{entry}}');
416 my $command = $self->prepare_command
417 ( $args, $fmt,
418 text => $self->make_kvt($args,$args->{'text'}),
419 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
420 );
421  
422 0 my ($rv,$text) = $self->command_string($command);
423 0 $self->_post($args);
424 0 ▶ return($rv == 0 ? $text : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
425 }
426 #: password boxes aren't supported by gdialog
427 sub password {
428 0 ▶ my $self = shift();
Subroutine password: not called CC=2 SCAR=17.9
Pod documented
429 0 ▶ return($self->inputbox('caller',((caller(1))[3]||'main'),@_,'password',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
430 }
431  
432 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
433 #: Text box
434 sub msgbox {
435 0 ▶ my $self = shift();
Subroutine msgbox: not called CC=15 SCAR=54.8
Pod documented
436 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
437 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
438 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
439 0 shift(); $caller = shift();
440 }
441 0 my $args = $self->_pre($caller,@_);
442  
443 0 ▶ $args->{'msgbox'} ||= 'msgbox';
Condition0%0/2
$args->{"msgbox"} ||= "msgbox"
l!l
00
MC/DC0%0/1
$args->{"msgbox"} ||= "msgbox"
$args->{"msgbox"}
Truth table0%0/2
A
A= $args->{"msgbox"}
Aresult
11
00
444  
445 0 my $fmt = $self->prepare_format($args);
446 0 $fmt = $self->append_format_base($args,$fmt);
447 0 ▶ if ($args->{'infobox'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args->{'infobox'}) { } 0 0 0
448 0 $fmt = $self->append_format($fmt,'--infobox');
449 }
450 else {
451 0 $fmt = $self->append_format($fmt,'--msgbox');
452 }
453 0 $fmt = $self->append_format($fmt,'{{text}} {{height}} {{width}}');
454 my $command = $self->prepare_command
455 ( $args, $fmt,
456 0 text => $self->make_kvt($args,$args->{'text'}),
457 );
458  
459 0 my $rv = $self->command_state($command);
460 0 ▶ if ($args->{'infobox'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args->{"infobox"}) 0 0 0
461 0 my $sec = 0;
462 0 ▶ if ($args->{'timeout'}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($args->{'timeout'}) { } 0 0 0
elsif ($args->{'wait'}) { } 0 0 0
463 0 ▶ $sec = int($args->{'timeout'} ? ($args->{'timeout'} / 1000.0) : 1.0);
Branch: 1 branch
BranchTrueFalseTotal
$args->{'timeout'} ? : 0 0 0
464 0 $self->_debug("Will sleep for timeout=".$sec);
465 } elsif ($args->{'wait'}) {
466 0 ▶ $sec = int($args->{'wait'} ? $args->{'wait'} : 1);
Branch: 1 branch
BranchTrueFalseTotal
$args->{'wait'} ? : 0 0 0
467 0 $self->_debug("Will sleep for wait=".$sec);
468 }
469 0 ▶ sleep($sec) if $sec;
Branch: 1 branch
BranchTrueFalseTotal
if $sec 0 0 0
470 }
471 0 $self->_post($args);
472 0 ▶ return($rv == 0 ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
473 }
474 sub infobox {
475 0 ▶ my $self = shift();
Subroutine infobox: not called CC=2 SCAR=17.9
Pod documented
476 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
477 }
478  
479 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
480 #: File box
481 sub textbox {
482 0 ▶ my $self = shift();
Subroutine textbox: not called CC=8 SCAR=42.8
Pod documented
483 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
484 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
485 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
486 0 shift(); $caller = shift();
487 }
488 0 my $args = $self->_pre($caller,@_);
489  
490 0 my $fmt = $self->prepare_format($args);
491 0 $fmt = $self->append_format_base($args,$fmt);
492 0 $fmt = $self->append_format($fmt,'--scrolltext');
493 0 $fmt = $self->append_format($fmt,'--textbox');
494 0 $fmt = $self->append_format($fmt,'{{path}} {{height}} {{width}}');
495 my $command = $self->prepare_command
496 ( $args, $fmt,
497 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
498 );
499  
500 0 my ($rv,$text) = $self->command_string($command);
501 0 $self->_post($args);
502 0 ▶ return($rv == 0 ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
503 }
504  
505 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
506 #: a simple menu
507 sub menu {
508 0 ▶ my $self = shift();
Subroutine menu: not called CC=8 SCAR=42.8
Pod documented
509 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
510 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
511 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
512 0 shift(); $caller = shift();
513 }
514 0 my $args = $self->_pre($caller,@_);
515  
516 $args->{'listheight'} = $args->{'menuheight'}
517 0 ▶ if exists $args->{'menuheight'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $args->{"menuheight"} 0 0 0
518  
519 0 my $fmt = $self->prepare_format($args);
520 0 $fmt = $self->append_format_base($args,$fmt);
521 0 $fmt = $self->append_format($fmt,'--menu');
522 0 $fmt = $self->append_format($fmt,'{{text}} {{height}} {{width}} {{listheight}} {{list}}');
523 my $command = $self->prepare_command
524 ( $args, $fmt,
525 0 text => $self->make_kvt($args,$args->{'text'}),
526 );
527  
528 0 my ($rv,$selected) = $self->command_string($command);
529 0 $self->_post($args);
530 0 ▶ return($rv == 0 ? $selected : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
531 }
532  
533 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
534 #: a check list
535 sub checklist {
536 0 ▶ my $self = shift();
Subroutine checklist: not called CC=12 SCAR=50.5
Pod documented
537 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
538 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
539 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
540 0 shift(); $caller = shift();
541 }
542 0 my $args = $self->_pre($caller,@_);
543  
544 $args->{'listheight'} = $args->{'menuheight'}
545 0 ▶ if exists $args->{'menuheight'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $args->{"menuheight"} 0 0 0
546  
547 0 my $fmt = $self->prepare_format($args);
548 0 $fmt = $self->append_format_base($args,$fmt);
549 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
550 0 ▶ if ($args->{radiolist}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args->{'radiolist'}) { } 0 0 0
551 0 $fmt = $self->append_format($fmt,'--radiolist');
552 }
553 else {
554 0 $fmt = $self->append_format($fmt,'--separate-output');
555 0 $fmt = $self->append_format($fmt,'--checklist');
556 }
557 0 $fmt = $self->append_format($fmt,'{{text}} {{height}} {{width}} {{listheight}} {{list}}');
558 my $command = $self->prepare_command
559 ( $args, $fmt,
560 0 text => $self->make_kvt($args,$args->{'text'}),
561 );
562  
563 0 ▶ if ($args->{radiolist}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args->{"radiolist"}) 0 0 0
564 0 my ($rv,$selected) = $self->command_string($command);
565 0 ▶ return($rv == 0 ? $selected : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
566 }
567 0 my ($rv,$selected) = $self->command_array($command);
568 0 ▶ return($rv == 0 ? @{$selected} : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
569 }
570 #: a radio button list
571 sub radiolist {
572 0 ▶ my $self = shift();
Subroutine radiolist: not called CC=2 SCAR=17.9
Pod documented
573 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
574 }
575  
576 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
577 #: file select
578 sub fselect {
579 0 ▶ my $self = shift();
Subroutine fselect: not called CC=9 SCAR=45.0
Pod documented
580 0 ▶ unless ($self->is_cdialog()) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->is_cdialog) 0 0 0
581 0 return($self->SUPER::fselect(@_));
582 }
583 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
584 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
585 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
586 0 shift(); $caller = shift();
587 }
588 0 my $args = $self->_pre($caller,@_);
589  
590 0 my $fmt = $self->prepare_format($args);
591 0 $fmt = $self->append_format_base($args,$fmt);
592 0 $fmt = $self->append_format($fmt,'--fselect');
593 0 $fmt = $self->append_format($fmt,'{{path}} {{height}} {{width}}');
594  
595 my $command = $self->prepare_command
596 ( $args, $fmt,
597 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
598 );
599  
600 0 my ($rv,$file) = $self->command_string($command);
601 0 $self->_post($args);
602 0 ▶ return($rv == 0 ? $file : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
603 }
604  
605 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
606 #: calendar
607  
608 sub calendar {
609 0 ▶ my $self = shift();
Subroutine calendar: not called CC=14 SCAR=53.5
Pod documented
610 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
611 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
612 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
613 0 shift(); $caller = shift();
614 }
615 0 my $args = $self->_pre($caller,@_);
616 0 ▶ $args->{'day'} ||= '1';
Condition0%0/2
$args->{"day"} ||= 1
l!l
00
MC/DC0%0/1
$args->{"day"} ||= 1
$args->{"day"}
Truth table0%0/2
A
A= $args->{"day"}
Aresult
11
00
617 0 ▶ $args->{'month'} ||= '1';
Condition0%0/2
$args->{"month"} ||= 1
l!l
00
MC/DC0%0/1
$args->{"month"} ||= 1
$args->{"month"}
Truth table0%0/2
A
A= $args->{"month"}
Aresult
11
00
618 0 ▶ $args->{'year'} ||= '1970';
Condition0%0/2
$args->{"year"} ||= 1970
l!l
00
MC/DC0%0/1
$args->{"year"} ||= 1970
$args->{"year"}
Truth table0%0/2
A
A= $args->{"year"}
Aresult
11
00
619  
620 0 my $fmt = $self->prepare_format($args);
621 0 $fmt = $self->append_format_base($args,$fmt);
622 0 $fmt = $self->append_format($fmt,'--calendar {{text}} {{listheight}} {{width}} {{day}} {{month}} {{year}}');
623 my $command = $self->prepare_command
624 ( $args, $fmt,
625 0 text => $self->make_kvt($args,$args->{'text'}),
626 );
627  
628 0 my ($rv,$date) = $self->command_string($command);
629 0 ▶ if ($rv == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rv == 0) 0 0 0
630 0 $self->ra(split(m!/!,$date));
631 }
632 0 $self->_post($args);
633 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
634 0 ▶ return($rv == 0 ? $self->ra() : (0,0,0));
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
635 }
636  
637 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
638 #: timebox
639  
640 sub timebox {
641 0 ▶ my $self = shift();
Subroutine timebox: not called CC=14 SCAR=53.5
Pod documented
642 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
643 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
644 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
645 0 shift(); $caller = shift();
646 }
647 0 my $args = $self->_pre($caller,@_);
648 0 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
649 0 ▶ $args->{'hour'} ||= $hour;
Condition0%0/3
$args->{"hour"} ||= $hour
l!l&&r!l&&!r
000
MC/DC0%0/2
$args->{"hour"} ||= $hour
$args->{"hour"} $hour
Truth table0%0/3
A ||= B
A= $args->{"hour"}B= $hour
ABresult
1X1
011
000
650 0 ▶ $args->{'minute'} ||= $min;
Condition0%0/3
$args->{"minute"} ||= $min
l!l&&r!l&&!r
000
MC/DC0%0/2
$args->{"minute"} ||= $min
$args->{"minute"} $min
Truth table0%0/3
A ||= B
A= $args->{"minute"}B= $min
ABresult
1X1
011
000
651 0 ▶ $args->{'second'} ||= $sec;
Condition0%0/3
$args->{"second"} ||= $sec
l!l&&r!l&&!r
000
MC/DC0%0/2
$args->{"second"} ||= $sec
$args->{"second"} $sec
Truth table0%0/3
A ||= B
A= $args->{"second"}B= $sec
ABresult
1X1
011
000
652  
653 0 my $fmt = $self->prepare_format($args);
654 0 $fmt = $self->append_format_base($args,$fmt);
655 0 $fmt = $self->append_format($fmt,'--timebox {{text}} {{height}} {{width}} {{hour}} {{minute}} {{second}}');
656 my $command = $self->prepare_command
657 ( $args, $fmt,
658 0 text => $self->make_kvt($args,$args->{'text'}),
659 );
660  
661 0 my ($rv,$time) = $self->command_string($command);
662 0 ▶ if ($rv == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rv == 0) 0 0 0
663 0 $self->ra(split(m!\:!,$time));
664 }
665 0 $self->_post($args);
666 0 ▶ return($rv == 0 ? $time : 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
667 0 ▶ return($rv == 0 ? $self->ra() : (0,0,0));
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
668 }
669  
670 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
671 #: tailbox
672  
673 sub tailbox {
674 0 ▶ my $self = shift();
Subroutine tailbox: not called CC=8 SCAR=42.8
Pod documented
675 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
676 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
677 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
678 0 shift(); $caller = shift();
679 }
680 0 my $args = $self->_pre($caller,@_);
681  
682 0 my $fmt = $self->prepare_format($args);
683 0 $fmt = $self->append_format_base($args,$fmt);
684 0 $fmt = $self->append_format($fmt,'--tailbox');
685 0 $fmt = $self->append_format($fmt,'{{path}} {{height}} {{width}}');
686 my $command = $self->prepare_command
687 ( $args, $fmt,
688 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
689 );
690  
691 0 my ($rv) = $self->command_state($command);
692 0 $self->_post($args);
693 0 ▶ return($rv == 0 ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
694 }
695  
696 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
697 #: tailboxbg
698  
699 sub tailboxbg {
700 0 ▶ my $self = shift();
Subroutine tailboxbg: not called CC=8 SCAR=42.8
Pod undocumented
701 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
702 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
703 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
704 0 shift(); $caller = shift();
705 }
706 0 my $args = $self->_pre($caller,@_);
707  
708 0 my $fmt = $self->prepare_format($args);
709 0 $fmt = $self->append_format_base($args,$fmt);
710 0 $fmt = $self->append_format($fmt,'--tailboxbg');
711 0 $fmt = $self->append_format($fmt,'{{path}} {{height}} {{width}}');
712 my $command = $self->prepare_command
713 ( $args, $fmt,
714 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
715 );
716  
717 0 my ($rv) = $self->command_state($command);
718 0 $self->_post($args);
719 0 ▶ return($rv == 0 ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
720 }
721  
722 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
723 #: an editable form (wow is this useful! holy cripes!)
724 sub form {
725 0 ▶ my $self = shift();
Subroutine form: not called CC=15 SCAR=54.8
Pod documented
726 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
727 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
728 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
729 0 shift(); $caller = shift();
730 }
731 0 my $args = $self->_pre($caller,@_);
732  
733 $args->{'listheight'} = $args->{'menuheight'}
734 0 ▶ if exists $args->{'menuheight'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $args->{"menuheight"} 0 0 0
735 $args->{'listheight'} = $args->{'formheight'}
736 0 ▶ if exists $args->{'formheight'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $args->{"formheight"} 0 0 0
737  
738 0 my $fmt = $self->prepare_format($args);
739 0 $fmt = $self->append_format_base($args,$fmt);
740 0 $fmt = $self->append_format($fmt,'--form');
741 0 $fmt = $self->append_format($fmt,'{{text}} {{height}} {{width}} {{listheight}} {{list}}');
742  
743 0 my $list = '';
744 0 ▶ while (@{$args->{'list'}}) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$args->{"list"};}) 0 0 0
745 0 my $item = shift(@{$args->{'list'}});
746 0 my $info = shift(@{$args->{'list'}});
747 0 $self->clean_format($args->{'trust-input'},\$item->[0]);
748 0 $self->clean_format($args->{'trust-input'},\$item->[1]);
749 0 $self->clean_format($args->{'trust-input'},\$item->[2]);
750 0 $self->clean_format($args->{'trust-input'},\$info->[0]);
751 0 $self->clean_format($args->{'trust-input'},\$info->[1]);
752 0 $self->clean_format($args->{'trust-input'},\$info->[2]);
753 0 $self->clean_format($args->{'trust-input'},\$info->[3]);
754 0 $self->clean_format($args->{'trust-input'},\$info->[4]);
755 0 ▶ $list .= ' "'.($item->[0]||' ').'" "'.$item->[1].'" "'.$item->[2].'" "'.($info->[0]||' ').'" "'.$info->[1].'" "'.$info->[2].'" "'.$info->[3].'" "'.$info->[4].'"';
Condition0%0/4
$item->[0] || ' '
l!l
00
$info->[0] || ' '
l!l
00
MC/DC0%0/1
$item->[0] || ' '
$item->[0]
MC/DC0%0/1
$info->[0] || ' '
$info->[0]
Truth table0%0/2
A
A= $item->[0]
Aresult
11
00
Truth table0%0/2
A
A= $info->[0]
Aresult
11
00
756 }
757 0 delete $args->{'list'};
758 0 $args->{'list'} = $list;
759  
760 my $command = $self->prepare_command
761 ( $args, $fmt,
762 0 list => $self->make_kvl($args,$args->{'list'}),
763 );
764  
765 0 my ($rv,$selected) = $self->command_array($command);
766 0 $self->_post($args);
767 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
768 0 ▶ return($rv == 0 ? $self->ra() : (0));
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
769 }
770  
771 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
772 #: progress meter
773 sub gauge_start {
774 0 ▶ my $self = shift();
Subroutine gauge_start: not called CC=12 SCAR=50.5
Pod documented
775 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
776 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
777 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
778 0 shift(); $caller = shift();
779 }
780 0 my $args = $self->_pre($caller,@_);
781  
782 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
783 0 $self->{'_GAUGE'}->{'ARGS'} = $args;
784  
785 0 ▶ if (defined $self->{'_GAUGE'}->{'FH'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"_GAUGE"}{"FH"}) 0 0 0
786 0 $self->rv(129);
787 0 $self->_post($args);
788 0 return(0);
789 }
790  
791 0 my $fmt = $self->prepare_format($args);
792 0 $fmt = $self->append_format_base($args,$fmt);
793 0 $fmt = $self->append_format($fmt,'--gauge');
794 0 $fmt = $self->append_format($fmt,'{{text}} {{height}} {{width}} {{percentage}}');
795 my $command = $self->prepare_command
796 ( $args, $fmt,
797 text => $self->make_kvt($args,$args->{'text'}),
798 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
799 );
800  
801 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
802 0 $self->{'_GAUGE'}->{'FH'} = new FileHandle;
803 0 $self->{'_GAUGE'}->{'FH'}->open("| $command");
804 0 my $rv = $? >> 8;
805 0 $self->{'_GAUGE'}->{'FH'}->autoflush(1);
806 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
807 0 $self->ra('null');
808 0 $self->rs('null');
809 0 ▶ return($rv && $rv >= 1);
Condition0%0/3
$rv && $rv >= 1
!ll&&!rl&&r
000
MC/DC0%0/2
$rv && $rv >= 1
$rv $rv >= 1
Truth table0%0/3
A && B
A= $rvB= $rv >= 1
ABresult
0X0
100
111
810 }
811 sub gauge_inc {
812 0 ▶ my $self = $_[0];
Subroutine gauge_inc: not called CC=4 SCAR=30.0
Pod documented
813 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
814  
815 0 ▶ return(0) unless defined $self->{'_GAUGE'}->{'FH'};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"_GAUGE"}{"FH"} 0 0 0
816  
817 0 my $fh = $self->{'_GAUGE'}->{'FH'};
818 0 $self->{'_GAUGE'}->{'PERCENT'} += $incr;
819 0 $SIG_CODE->{$$} = $self; local $SIG{'PIPE'} = \&_del_gauge;
820 0 print $fh $self->{'_GAUGE'}->{'PERCENT'}."\n";
821 0 ▶ return(((defined $self->{'_GAUGE'}->{'FH'}) ? 1 : 0));
Branch: 1 branch
BranchTrueFalseTotal
defined $self->{'_GAUGE'}{'FH'} ? : 0 0 0
822 }
823 sub gauge_dec {
824 0 ▶ my $self = $_[0];
Subroutine gauge_dec: not called CC=4 SCAR=30.0
Pod documented
825 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
826  
827 0 ▶ return(0) unless defined $self->{'_GAUGE'}->{'FH'};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"_GAUGE"}{"FH"} 0 0 0
828  
829 0 my $fh = $self->{'_GAUGE'}->{'FH'};
830 0 $self->{'_GAUGE'}->{'PERCENT'} -= $decr;
831 0 $SIG_CODE->{$$} = $self; local $SIG{'PIPE'} = \&_del_gauge;
832 0 print $fh $self->{'_GAUGE'}->{'PERCENT'}."\n";
833 0 ▶ return(((defined $self->{'_GAUGE'}->{'FH'}) ? 1 : 0));
Branch: 1 branch
BranchTrueFalseTotal
defined $self->{'_GAUGE'}{'FH'} ? : 0 0 0
834 }
835 sub gauge_set {
836 0 ▶ my $self = $_[0];
Subroutine gauge_set: not called CC=5 SCAR=34.0
Pod documented
837 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
838  
839 0 ▶ return(0) unless $self->{'_GAUGE'}->{'FH'};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"_GAUGE"}{"FH"} 0 0 0
840  
841 0 my $fh = $self->{'_GAUGE'}->{'FH'};
842 0 $self->{'_GAUGE'}->{'PERCENT'} = $perc;
843 0 $SIG_CODE->{$$} = $self; local $SIG{'PIPE'} = \&_del_gauge;
844 0 print $fh $self->{'_GAUGE'}->{'PERCENT'}."\n";
845 0 ▶ return(((defined $self->{'_GAUGE'}->{'FH'}) ? 1 : 0));
Branch: 1 branch
BranchTrueFalseTotal
defined $self->{'_GAUGE'}{'FH'} ? : 0 0 0
846 }
847 # funky flicker... grr
848 sub gauge_text {
849 0 ▶ my $self = $_[0];
Subroutine gauge_text: not called CC=4 SCAR=30.0
Pod documented
850 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
851  
852 0 ▶ return(0) unless $self->{'_GAUGE'}->{'FH'};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"_GAUGE"}{"FH"} 0 0 0
853  
854 0 my $fh = $self->{'_GAUGE'}->{'FH'};
855 0 $SIG_CODE->{$$} = $self; local $SIG{'PIPE'} = \&_del_gauge;
856 0 print $fh "\nXXX\n\n".$mesg."\n\nXXX\n\n".$self->{'_GAUGE'}->{'PERCENT'}."\n";
857 0 ▶ return(((defined $self->{'_GAUGE'}->{'FH'}) ? 1 : 0));
Branch: 1 branch
BranchTrueFalseTotal
defined $self->{'_GAUGE'}{'FH'} ? : 0 0 0
858 }
859 sub gauge_stop {
860 0 ▶ my $self = $_[0];
Subroutine gauge_stop: not called CC=2 SCAR=17.9
Pod documented
861  
862 0 ▶ return(0) unless $self->{'_GAUGE'}->{'FH'};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"_GAUGE"}{"FH"} 0 0 0
863  
864 0 my $args = $self->{'_GAUGE'}->{'ARGS'};
865 0 my $fh = $self->{'_GAUGE'}->{'FH'};
866 0 $SIG_CODE->{$$} = $self; local $SIG{'PIPE'} = \&_del_gauge;
867 0 $self->{'_GAUGE'}->{'FH'}->close();
868 0 delete($self->{'_GAUGE'}->{'FH'});
869 0 delete($self->{'_GAUGE'}->{'ARGS'});
870 0 delete($self->{'_GAUGE'}->{'PERCENT'});
871 0 delete($self->{'_GAUGE'});
872 0 $self->rv('null');
873 0 $self->rs('null');
874 0 $self->ra('null');
875 0 $self->_post($args);
876 0 return(1);
877 }
878  
879  
880 6 1;
881  
« Dialog.pm ↑ Summary Dialog/Backend.pm »