Dialog/Backend/KDialog.pm

filter: Statementstmt 23.5% 53 / 225 Branchbran 6.7% 5 / 74 Conditioncond 13.3% 20 / 150 MC/DCmcdc 0.0% 0 / 80 Subroutinesub 28.1% 9 / 32 Podpod 79.1% 19 / 24 totaltotal 18.1% 106 / 585 CC 106 SCAR 43.9
CC
106
Cov
17%
checklist
156.0
fselect
132.0
new
125.0
CRAP 80.9
« Dialog/KDE.pm ↑ Summary Dialog/Backend/Nautilus.pm »
1 package UI::Dialog::Backend::KDialog;
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 Cwd qw( abs_path );
Subroutine BEGIN: called CC=1 SCAR=0.0
24 2 ▶use UI::Dialog::Backend;
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 BEGIN {
27 2 ▶ use vars qw( $VERSION @ISA );
Subroutine BEGIN: called CC=1 SCAR=0.0
28 2 ▶ @ISA = qw( UI::Dialog::Backend );
Subroutine BEGIN: called CC=1 SCAR=0.0
29 2 $VERSION = '1.20';
30 }
31  
32 #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
33 #: Constructor Method
34 #:
35  
36 sub new {
37 1 ▶ my $proto = shift();
Subroutine new: called CC=31 SCAR=48.3
Pod documented
38 1 ▶ my $class = ref($proto) || $proto;
Condition33%1/3
ref $proto || $proto
l!l&&r!l&&!r
010
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
39 1 ▶ my $cfg = ((ref($_[0]) eq "HASH") ? $_[0] : (@_) ? { @_ } : {});
Branch: 2 branches
BranchTrueFalseTotal
ref $_[0] eq 'HASH' ? : 0 1 1
@_ ? : 1 0 1
40 1 my $self = {};
41 1 bless($self, $class);
42 1 $self->{'_state'} = {};
43 1 $self->{'_opts'} = {};
44  
45 #: Dynamic path discovery...
46 1 my $CFG_PATH = $cfg->{'PATH'};
47 1 ▶ if ($CFG_PATH) {
Branch: 2 branches
BranchTrueFalseTotal
if ($CFG_PATH) { } 0 1 1
elsif ($ENV{'PATH'}) { } 1 0 1
48 0 ▶ if (ref($CFG_PATH) eq "ARRAY") {
Branch: 3 branches
BranchTrueFalseTotal
if (ref $CFG_PATH eq 'ARRAY') { } 0 0 0
elsif ($CFG_PATH =~ /:/) { } 0 0 0
elsif (-d $CFG_PATH) { } 0 0 0
49 0 $self->{'PATHS'} = $CFG_PATH;
50 }
51 elsif ($CFG_PATH =~ m!:!) {
52 0 $self->{'PATHS'} = [ split(/:/,$CFG_PATH) ];
53 }
54 elsif (-d $CFG_PATH) {
55 0 $self->{'PATHS'} = [ $CFG_PATH ];
56 }
57 }
58 elsif ($ENV{'PATH'}) {
59 1 $self->{'PATHS'} = [ split(/:/,$ENV{'PATH'}) ];
60 }
61 else {
62 0 $self->{'PATHS'} = '';
63 }
64  
65 1 ▶ $self->{'_opts'}->{'literal'} = $cfg->{'literal'} || 0;
Condition50%1/2
$cfg->{'literal'} || 0
l!l
01
MC/DC0%0/1
$cfg->{'literal'} || 0
$cfg->{'literal'}
Truth table50%1/2
A
A= $cfg->{'literal'}
Aresult
11
00
66 1 ▶ $self->{'_opts'}->{'callbacks'} = $cfg->{'callbacks'} || undef();
Condition50%1/2
$cfg->{'callbacks'} || undef()
l!l
01
MC/DC0%0/1
$cfg->{'callbacks'} || undef()
$cfg->{'callbacks'}
Truth table50%1/2
A
A= $cfg->{'callbacks'}
Aresult
11
00
67 1 ▶ $self->{'_opts'}->{'debug'} = $cfg->{'debug'} || undef();
Condition50%1/2
$cfg->{'debug'} || undef()
l!l
01
MC/DC0%0/1
$cfg->{'debug'} || undef()
$cfg->{'debug'}
Truth table50%1/2
A
A= $cfg->{'debug'}
Aresult
11
00
68 1 ▶ $self->{'_opts'}->{'caption'} = $cfg->{'caption'} || undef();
Condition50%1/2
$cfg->{'caption'} || undef()
l!l
01
MC/DC0%0/1
$cfg->{'caption'} || undef()
$cfg->{'caption'}
Truth table50%1/2
A
A= $cfg->{'caption'}
Aresult
11
00
69 1 ▶ $self->{'_opts'}->{'icon'} = $cfg->{'icon'} || undef();
Condition50%1/2
$cfg->{'icon'} || undef()
l!l
01
MC/DC0%0/1
$cfg->{'icon'} || undef()
$cfg->{'icon'}
Truth table50%1/2
A
A= $cfg->{'icon'}
Aresult
11
00
70 1 ▶ $self->{'_opts'}->{'miniicon'} = $cfg->{'miniicon'} || undef();
Condition50%1/2
$cfg->{'miniicon'} || undef()
l!l
01
MC/DC0%0/1
$cfg->{'miniicon'} || undef()
$cfg->{'miniicon'}
Truth table50%1/2
A
A= $cfg->{'miniicon'}
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'}->{'bin'} ||= $self->_find_bin('kdialog');
Condition33%1/3
$self->{"_opts"}{"bin"} ||= $self->_find_bin("kdialog")
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->{"_opts"}{"bin"} ||= $self->_find_bin("kdialog")
$self->{"_opts"}{"bin"} $self->_find_bin("kdialog")
Truth table33%1/3
A ||= B
A= $self->{"_opts"}{"bin"}B= $self->_find_bin("kdialog")
ABresult
1X1
011
000
75 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
76 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
77 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
78 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
79 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
80 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
81 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
82 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
83 1 ▶ unless (-x $self->{'_opts'}->{'bin'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-x $self->{"_opts"}{"bin"}) 1 0 1
84 1 croak("the kdialog binary could not be found at: ".$self->{'_opts'}->{'bin'});
85 }
86  
87 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
88  
89 0 ▶ $self->{'test_mode'} = $cfg->{'test_mode'} if exists $cfg->{'test_mode'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $cfg->{"test_mode"} 0 0 0
90 0 $self->{'test_mode_result'} = '';
91  
92 0 return($self);
93 }
94  
95 #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
96 #: Private Methods
97 #:
98  
99 sub append_format_base {
100 0 ▶ my ($self,$args,$fmt) = @_;
Subroutine append_format_base: not called CC=2 SCAR=17.9
Pod undocumented
101 0 $fmt = $self->append_format_check($args,$fmt,'caption','--caption {{caption}}');
102 0 $fmt = $self->append_format_check($args,$fmt,'icon','--icon {{icon}}');
103 0 $fmt = $self->append_format_check($args,$fmt,'miniicon','--miniicon {{miniicon}}');
104 0 ▶ if ($self->{'_opts'}->{'force-no-separate-output'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_opts'}{'force-no-separate-output'}) { } 0 0 0
105 0 delete $args->{'separate-output'};
106 }
107 else {
108 0 $fmt = $self->append_format_check($args,$fmt,"separate-output","--separate-output");
109 }
110 0 return $fmt;
111 }
112  
113 #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
114 #: Public Methods
115 #:
116  
117  
118 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
119 #: Ask a binary question (Yes/No)
120 sub yesno {
121 0 ▶ my $self = shift();
Subroutine yesno: not called CC=10 SCAR=47.0
Pod documented
122 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
123 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
124 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
125 0 shift(); $caller = shift();
126 }
127 0 my $args = $self->_pre($caller,@_);
128  
129 0 ▶ $args->{'yesno'} ||= "yesno";
Condition0%0/2
$args->{"yesno"} ||= "yesno"
l!l
00
MC/DC0%0/1
$args->{"yesno"} ||= "yesno"
$args->{"yesno"}
Truth table0%0/2
A
A= $args->{"yesno"}
Aresult
11
00
130  
131 0 my $fmt = $self->prepare_format($args);
132 0 $fmt = $self->append_format_base($args,$fmt);
133 0 $fmt = $self->append_format($fmt,'--'.$args->{'yesno'}.' {{text}} {{height}} {{width}}');
134 my $command = $self->prepare_command
135 ( $args, $fmt,
136 0 text => $self->make_kvt($args,$args->{'text'}),
137 );
138  
139 0 my $rv = $self->command_state($command);
140 0 ▶ if ($rv && $rv >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rv and $rv >= 1) { } 0 0 0
Condition0%0/3
$rv and $rv >= 1
!ll&&!rl&&r
000
MC/DC0%0/2
$rv and $rv >= 1
$rv $rv >= 1
Truth table0%0/3
A and B
A= $rvB= $rv >= 1
ABresult
0X0
100
111
141 0 $self->ra("NO");
142 0 $self->rs("NO");
143 0 $self->rv($rv);
144 } else {
145 0 $self->ra("YES");
146 0 $self->rs("YES");
147 0 $self->rv('null');
148 }
149 0 $self->_post($args);
150 0 ▶ return($rv == 0 ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
151 }
152 sub yesnocancel {
153 0 ▶ my $self = shift();
Subroutine yesnocancel: not called CC=2 SCAR=17.9
Pod documented
154 0 ▶ return($self->yesno('caller',((caller(1))[3]||'main'),@_,'yesno','yesnocancel'));
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
155 }
156 sub warningyesno {
157 0 ▶ my $self = shift();
Subroutine warningyesno: not called CC=2 SCAR=17.9
Pod documented
158 0 ▶ return($self->yesno('caller',((caller(1))[3]||'main'),@_,'yesno','warningyesno'));
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
159 }
160 sub warningyesnocancel {
161 0 ▶ my $self = shift();
Subroutine warningyesnocancel: not called CC=2 SCAR=17.9
Pod documented
162 0 ▶ return($self->yesno('caller',((caller(1))[3]||'main'),@_,'yesno','warningyesnocancel'));
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
163 }
164 #: Broken documented "feature"
165 # sub warningcontinuecancel {
166 # my $self = shift();
167 # return($self->yesno(@_,'yesno','warningcontinuecancel'));
168 # }
169 sub noyes {
170 0 ▶ my $self = shift();
Subroutine noyes: not called CC=2 SCAR=17.9
Pod undocumented
171 0 ▶ return($self->yesno('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
172 }
173  
174 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
175 #: Text entry
176 sub inputbox {
177 0 ▶ my $self = shift();
Subroutine inputbox: not called CC=9 SCAR=45.0
Pod documented
178 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
179 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
180 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
181 0 shift(); $caller = shift();
182 }
183 0 my $args = $self->_pre($caller,@_);
184  
185 0 ▶ $args->{'inputbox'} ||= 'inputbox';
Condition0%0/2
$args->{"inputbox"} ||= "inputbox"
l!l
00
MC/DC0%0/1
$args->{"inputbox"} ||= "inputbox"
$args->{"inputbox"}
Truth table0%0/2
A
A= $args->{"inputbox"}
Aresult
11
00
186  
187 0 my $fmt = $self->prepare_format($args);
188 0 $fmt = $self->append_format_base($args,$fmt);
189 0 $fmt = $self->append_format($fmt,'--'.$args->{'inputbox'}.' {{text}} {{entry}}');
190 my $command = $self->prepare_command
191 ( $args, $fmt,
192 text => $self->make_kvt($args,$args->{'text'}),
193 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
194 );
195  
196 0 my ($rv,$text) = $self->command_string($command);
197 0 $self->_post($args);
198 0 ▶ return($rv == 0 ? $text : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
199 }
200 sub password {
201 0 ▶ my $self = shift();
Subroutine password: not called CC=2 SCAR=17.9
Pod documented
202 0 ▶ return($self->inputbox('caller',((caller(1))[3]||'main'),@_,'inputbox','password'));
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
203 }
204  
205 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
206 #: Text box
207 sub msgbox {
208 0 ▶ my $self = shift();
Subroutine msgbox: not called CC=8 SCAR=42.8
Pod documented
209 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
210 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
211 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
212 0 shift(); $caller = shift();
213 }
214 0 my $args = $self->_pre($caller,@_);
215  
216 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
217  
218 0 my $fmt = $self->prepare_format($args);
219 0 $fmt = $self->append_format_base($args,$fmt);
220 0 $fmt = $self->append_format($fmt,'--'.$args->{'msgbox'}.' {{text}}');
221 my $command = $self->prepare_command
222 ( $args, $fmt,
223 0 text => $self->make_kvt($args,$args->{'text'}),
224 );
225  
226 0 my $rv = $self->command_state($command);
227 0 $self->_post($args);
228 0 ▶ return($rv == 0 ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
229 }
230 sub error {
231 0 ▶ my $self = shift();
Subroutine error: not called CC=2 SCAR=17.9
Pod undocumented
232 0 ▶ return($self->msgbox('caller',((caller(1))[3]||'main'),@_,'msgbox','error'));
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
233 }
234 sub sorry {
235 0 ▶ my $self = shift();
Subroutine sorry: not called CC=2 SCAR=17.9
Pod undocumented
236 0 ▶ return($self->msgbox('caller',((caller(1))[3]||'main'),@_,'msgbox','sorry'));
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
237 }
238 sub infobox {
239 0 ▶ my $self = shift();
Subroutine infobox: not called CC=2 SCAR=17.9
Pod undocumented
240 0 ▶ return($self->msgbox('caller',((caller(1))[3]||'main'),@_,'msgbox','msgbox'));
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
241 }
242  
243 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
244 #: File box
245 sub textbox {
246 0 ▶ my $self = shift();
Subroutine textbox: not called CC=9 SCAR=45.0
Pod documented
247 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
248 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
249 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
250 0 shift(); $caller = shift();
251 }
252 0 my $args = $self->_pre($caller,@_);
253  
254 0 my $fmt = $self->prepare_format($args);
255 0 $fmt = $self->append_format_base($args,$fmt);
256 0 $fmt = $self->append_format($fmt,'--textbox');
257 0 $fmt = $self->append_format($fmt,'{{path}} {{height}} {{width}}');
258 my $command = $self->prepare_command
259 ( $args, $fmt,
260 0 ▶ path => $self->make_kvl($args,($args->{'filename'}||$args->{'path'}||'.')),
Condition0%0/5
$args->{'filename'} || $args->{'path'} || '.'
l!l
00
$args->{"filename"} or $args->{"path"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$args->{'filename'} || $args->{'path'} || '.'
$args->{"filename"} $args->{"path"}
Truth table0%0/3
A or B
A= $args->{"filename"}B= $args->{"path"}
ABresult
1X1
011
000
261 );
262  
263 0 my ($rv,$text) = $self->command_string($command);
264 0 $self->_post($args);
265 0 ▶ return($rv == 0 ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
266 }
267  
268 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
269 #: a simple menu
270 sub menu {
271 0 ▶ my $self = shift();
Subroutine menu: not called CC=7 SCAR=40.3
Pod documented
272 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
273 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
274 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
275 0 shift(); $caller = shift();
276 }
277 0 my $args = $self->_pre($caller,@_);
278  
279 0 my $fmt = $self->prepare_format($args);
280 0 $fmt = $self->append_format_base($args,$fmt);
281 0 $fmt = $self->append_format($fmt,'--separate-output');
282 0 $fmt = $self->append_format($fmt,'--menu');
283 0 $fmt = $self->append_format($fmt,'{{text}} {{list}}');
284 my $command = $self->prepare_command
285 ( $args, $fmt,
286 0 text => $self->make_kvt($args,$args->{'text'}),
287 );
288  
289 0 my ($rv,$selected) = $self->command_string($command);
290 0 $self->_post($args);
291 0 ▶ return($rv == 0 ? $selected : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
292 }
293  
294 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
295 #: a check list
296 sub checklist {
297 0 ▶ my $self = shift();
Subroutine checklist: not called CC=12 SCAR=50.5
Pod documented
298 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
299 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
300 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
301 0 shift(); $caller = shift();
302 }
303 0 my $args = $self->_pre($caller,@_);
304  
305 $args->{'listheight'} = $args->{'menuheight'}
306 0 ▶ if exists $args->{'menuheight'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $args->{"menuheight"} 0 0 0
307  
308 0 my $fmt = $self->prepare_format($args);
309 0 $fmt = $self->append_format_base($args,$fmt);
310 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
311 0 ▶ if ($args->{radiolist}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args->{'radiolist'}) { } 0 0 0
312 0 $fmt = $self->append_format($fmt,'--radiolist');
313 }
314 else {
315 0 $fmt = $self->append_format($fmt,'--separate-output');
316 0 $fmt = $self->append_format($fmt,'--checklist');
317 }
318 0 $fmt = $self->append_format($fmt,'{{text}} {{list}}');
319 my $command = $self->prepare_command
320 ( $args, $fmt,
321 0 text => $self->make_kvt($args,$args->{'text'}),
322 );
323  
324 0 ▶ if ($args->{radiolist}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args->{"radiolist"}) 0 0 0
325 0 my ($rv,$selected) = $self->command_string($command);
326 0 ▶ return($rv == 0 ? $selected : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
327 }
328 0 my ($rv,$selected) = $self->command_array($command);
329 0 ▶ return($rv == 0 ? @{$selected} : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
330 }
331 #: a radio button list
332 sub radiolist {
333 0 ▶ my $self = shift();
Subroutine radiolist: not called CC=2 SCAR=17.9
Pod documented
334 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
335 }
336  
337  
338 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
339 #: file select
340 sub fselect {
341 0 ▶ my $self = shift();
Subroutine fselect: not called CC=11 SCAR=48.8
Pod documented
342 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
343 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
344 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
345 0 shift(); $caller = shift();
346 }
347 0 my $args = $self->_pre($caller,@_);
348  
349 0 ▶ $args->{'fselect'} ||= 'getopenfilename';
Condition0%0/2
$args->{"fselect"} ||= "getopenfilename"
l!l
00
MC/DC0%0/1
$args->{"fselect"} ||= "getopenfilename"
$args->{"fselect"}
Truth table0%0/2
A
A= $args->{"fselect"}
Aresult
11
00
350  
351 0 my $fmt = $self->prepare_format($args);
352 0 $fmt = $self->append_format_base($args,$fmt);
353 0 $fmt = $self->append_format($fmt,'--separate-output');
354 0 $fmt = $self->append_format($fmt,'--'.$args->{'fselect'});
355 0 ▶ if ($args->{'getexistingdirectory'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args->{'getexistingdirectory'}) { } 0 0 0
356 0 $fmt = $self->append_format($fmt,'{{path}}');
357 } else {
358 0 $fmt = $self->append_format($fmt,'{{path}} {{filter}}');
359 }
360 my $command = $self->prepare_command
361 ( $args, $fmt,
362 path => $self->make_kvl($args,($args->{'path'}||abs_path())),
363 0 ▶ filter => $self->make_kvl($args,($args->{'filter'}||'*'))
Condition0%0/5
$args->{'path'} || abs_path()
l!l&&r!l&&!r
000
$args->{'filter'} || '*'
l!l
00
MC/DC0%0/2
$args->{'path'} || abs_path()
$args->{'path'} abs_path()
MC/DC0%0/1
$args->{'filter'} || '*'
$args->{'filter'}
Truth table0%0/3
A || B
A= $args->{'path'}B= abs_path()
ABresult
1X1
011
000
Truth table0%0/2
A
A= $args->{'filter'}
Aresult
11
00
364 );
365  
366 0 my ($rv,$selected) = $self->command_string($command);
367 0 $self->_post($args);
368 0 ▶ return($rv == 0 ? $selected : 0);
Branch: 1 branch
BranchTrueFalseTotal
$rv == 0 ? : 0 0 0
369 }
370 sub getopenfilename {
371 0 ▶ my $self = shift();
Subroutine getopenfilename: not called CC=2 SCAR=17.9
Pod documented
372 0 ▶ return($self->fselect('caller',((caller(1))[3]||'main'),@_,'fselect','getopenfilename'));
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
373 }
374 sub getsavefilename {
375 0 ▶ my $self = shift();
Subroutine getsavefilename: not called CC=2 SCAR=17.9
Pod documented
376 0 ▶ return($self->fselect('caller',((caller(1))[3]||'main'),@_,'fselect','getsavefilename'));
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
377 }
378 sub getopenurl {
379 0 ▶ my $self = shift();
Subroutine getopenurl: not called CC=2 SCAR=17.9
Pod documented
380 0 ▶ return($self->fselect('caller',((caller(1))[3]||'main'),@_,'fselect','getopenurl'));
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
381 }
382 sub getsaveurl {
383 0 ▶ my $self = shift();
Subroutine getsaveurl: not called CC=2 SCAR=17.9
Pod documented
384 0 ▶ return($self->fselect('caller',((caller(1))[3]||'main'),@_,'fselect','getsaveurl'));
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
385 }
386  
387 #:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
388 #: directory select
389 sub dselect {
390 0 ▶ my $self = shift();
Subroutine dselect: not called CC=2 SCAR=17.9
Pod documented
391 0 ▶ return($self->fselect('caller',((caller(1))[3]||'main'),@_,'fselect','getexistingdirectory'));
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
392 }
393 sub getexistingdirectory {
394 0 ▶ my $self = shift();
Subroutine getexistingdirectory: not called CC=2 SCAR=17.9
Pod documented
395 0 ▶ return($self->fselect('caller',((caller(1))[3]||'main'),@_,'fselect','getexistingdirectory'));
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 }
397  
398  
399 2 1;
« Dialog/KDE.pm ↑ Summary Dialog/Backend/Nautilus.pm »