line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package UI::Dialog; |
2
|
|
|
|
|
|
|
############################################################################### |
3
|
|
|
|
|
|
|
# Copyright (C) 2015 Kevin C. Krinke |
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
|
1
|
|
|
1
|
|
21706
|
use 5.006; |
|
1
|
|
|
|
|
4
|
|
20
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
21
|
1
|
|
|
1
|
|
7
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
101
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
BEGIN { |
24
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
50
|
|
25
|
1
|
|
|
1
|
|
2282
|
$VERSION = '1.12'; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
29
|
|
|
|
|
|
|
#: Constructor Method |
30
|
|
|
|
|
|
|
#: |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub new { |
33
|
1
|
|
|
1
|
1
|
488
|
my $proto = shift(); |
34
|
1
|
|
33
|
|
|
7
|
my $class = ref($proto) || $proto; |
35
|
1
|
|
50
|
|
|
4
|
my $cfg = {@_} || {}; |
36
|
1
|
|
|
|
|
2
|
my $self = {}; |
37
|
1
|
|
|
|
|
3
|
bless($self, $class); |
38
|
|
|
|
|
|
|
|
39
|
1
|
|
50
|
|
|
12
|
$self->{'debug'} = $cfg->{'debug'} || 0; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
#: Dynamic path discovery... |
42
|
1
|
|
|
|
|
3
|
my $CFG_PATH = $cfg->{'PATH'}; |
43
|
1
|
50
|
|
|
|
6
|
if ($CFG_PATH) { |
|
|
50
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
0
|
if (ref($CFG_PATH) eq "ARRAY") { $self->{'PATHS'} = $CFG_PATH; } |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
45
|
0
|
|
|
|
|
0
|
elsif ($CFG_PATH =~ m!:!) { $self->{'PATHS'} = [ split(/:/,$CFG_PATH) ]; } |
46
|
0
|
|
|
|
|
0
|
elsif (-d $CFG_PATH) { $self->{'PATHS'} = [ $CFG_PATH ]; } |
47
|
1
|
|
|
|
|
10
|
} elsif ($ENV{'PATH'}) { $self->{'PATHS'} = [ split(/:/,$ENV{'PATH'}) ]; } |
48
|
0
|
|
|
|
|
0
|
else { $self->{'PATHS'} = ''; } |
49
|
|
|
|
|
|
|
|
50
|
1
|
50
|
33
|
|
|
9
|
if (not $cfg->{'order'} and ($ENV{'DISPLAY'} && length($ENV{'DISPLAY'}) > 0)) { |
|
|
|
33
|
|
|
|
|
51
|
|
|
|
|
|
|
#: Pick a GUI mode 'cause a DISPLAY was detected |
52
|
0
|
0
|
|
|
|
0
|
if ($ENV{'TERM'} =~ /^dumb$/i) { |
53
|
|
|
|
|
|
|
# we're running free of a terminal |
54
|
0
|
|
|
|
|
0
|
$cfg->{'order'} = [ 'zenity', 'xdialog', 'gdialog', 'kdialog' ]; |
55
|
|
|
|
|
|
|
} else { |
56
|
|
|
|
|
|
|
# we're running in a terminal |
57
|
0
|
|
|
|
|
0
|
$cfg->{'order'} = [ 'zenity', 'xdialog', 'gdialog', 'kdialog', 'whiptail', 'cdialog', 'ascii' ]; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
# verify and repair the order |
61
|
|
|
|
|
|
|
$cfg->{'order'} = ((ref($cfg->{'order'}) eq "ARRAY") ? $cfg->{'order'} : |
62
|
1
|
50
|
|
|
|
7
|
($cfg->{'order'}) ? [ $cfg->{'order'} ] : |
|
|
50
|
|
|
|
|
|
63
|
|
|
|
|
|
|
[ 'cdialog', 'whiptail', 'ascii' ]); |
64
|
|
|
|
|
|
|
|
65
|
1
|
|
50
|
|
|
10
|
$self->_debug("ENV->UI_DIALOGS: ".($ENV{'UI_DIALOGS'}||'NULL'),2); |
66
|
1
|
50
|
|
|
|
4
|
$cfg->{'order'} = [ split(/\:/,$ENV{'UI_DIALOGS'}) ] if $ENV{'UI_DIALOGS'}; |
67
|
|
|
|
|
|
|
|
68
|
1
|
|
50
|
|
|
16
|
$self->_debug("ENV->UI_DIALOG: ".($ENV{'UI_DIALOG'}||'NULL'),2); |
69
|
1
|
50
|
|
|
|
4
|
unshift(@{$cfg->{'order'}},$ENV{'UI_DIALOG'}) if $ENV{'UI_DIALOG'}; |
|
0
|
|
|
|
|
0
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
$cfg->{'trust-input'} = |
72
|
|
|
|
|
|
|
( exists $cfg->{'trust-input'} |
73
|
1
|
50
|
33
|
|
|
6
|
&& $cfg->{'trust-input'}==1 |
74
|
|
|
|
|
|
|
) ? 1 : 0; |
75
|
|
|
|
|
|
|
|
76
|
1
|
|
|
|
|
3
|
my @opts = (); |
77
|
1
|
|
|
|
|
4
|
foreach my $opt (keys(%$cfg)) { push(@opts,$opt,$cfg->{$opt}); } |
|
2
|
|
|
|
|
5
|
|
78
|
|
|
|
|
|
|
|
79
|
1
|
|
|
|
|
3
|
$self->_debug("order: @{$cfg->{'order'}}",2); |
|
1
|
|
|
|
|
5
|
|
80
|
|
|
|
|
|
|
|
81
|
1
|
50
|
|
|
|
4
|
if (ref($cfg->{'order'}) eq "ARRAY") { |
82
|
1
|
|
|
|
|
2
|
foreach my $try (@{$cfg->{'order'}}) { |
|
1
|
|
|
|
|
3
|
|
83
|
2
|
50
|
|
|
|
48
|
if ($try =~ /^zenity$/i) { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
84
|
0
|
|
|
|
|
0
|
$self->_debug("trying zenity",2); |
85
|
0
|
0
|
0
|
|
|
0
|
if (eval "require UI::Dialog::Backend::Zenity; 1" && $self->_has_variant('zenity')) { |
86
|
0
|
|
|
|
|
0
|
require UI::Dialog::Backend::Zenity; |
87
|
0
|
|
|
|
|
0
|
$self->{'_ui_dialog'} = new UI::Dialog::Backend::Zenity (@opts); |
88
|
0
|
|
|
|
|
0
|
$self->_debug("using zenity",2); |
89
|
0
|
|
|
|
|
0
|
last; |
90
|
0
|
|
|
|
|
0
|
} else { next; } |
91
|
|
|
|
|
|
|
} elsif ($try =~ /^(?:gdialog|gdialog\.real)$/i) { |
92
|
0
|
|
|
|
|
0
|
$self->_debug("trying gdialog",2); |
93
|
|
|
|
|
|
|
#: In Debian, gdialog is now being diverted to gdialog.real as zenity is the gnome2 replacement |
94
|
0
|
0
|
0
|
|
|
0
|
if (eval "require UI::Dialog::Backend::GDialog; 1" && ($self->_has_variant('gdialog.real') || |
|
|
|
0
|
|
|
|
|
95
|
|
|
|
|
|
|
$self->_has_variant('gdialog'))) { |
96
|
0
|
|
|
|
|
0
|
require UI::Dialog::Backend::GDialog; |
97
|
0
|
|
|
|
|
0
|
$self->{'_ui_dialog'} = new UI::Dialog::Backend::GDialog (@opts); |
98
|
0
|
|
|
|
|
0
|
$self->_debug("using gdialog ",2); |
99
|
0
|
|
|
|
|
0
|
last; |
100
|
0
|
|
|
|
|
0
|
} else { next; } |
101
|
|
|
|
|
|
|
} elsif ($try =~ /^(?:xdialog|X)$/i) { |
102
|
0
|
|
|
|
|
0
|
$self->_debug("trying xdialog",2); |
103
|
0
|
0
|
0
|
|
|
0
|
if (eval "require UI::Dialog::Backend::XDialog; 1" && $self->_has_variant('Xdialog')) { |
104
|
0
|
|
|
|
|
0
|
require UI::Dialog::Backend::XDialog; |
105
|
0
|
|
|
|
|
0
|
$self->{'_ui_dialog'} = new UI::Dialog::Backend::XDialog (@opts,'XDIALOG_HIGH_DIALOG_COMPAT',1); |
106
|
0
|
|
|
|
|
0
|
$self->_debug("using xdialog",2); |
107
|
0
|
|
|
|
|
0
|
last; |
108
|
0
|
|
|
|
|
0
|
} else { next; } |
109
|
|
|
|
|
|
|
} elsif ($try =~ /^kdialog$/i) { |
110
|
0
|
|
|
|
|
0
|
$self->_debug("trying kdialog",2); |
111
|
0
|
0
|
0
|
|
|
0
|
if (eval "require UI::Dialog::Backend::KDialog; 1" && $self->_has_variant('kdialog')) { |
112
|
0
|
|
|
|
|
0
|
require UI::Dialog::Backend::KDialog; |
113
|
0
|
|
|
|
|
0
|
$self->{'_ui_dialog'} = new UI::Dialog::Backend::KDialog (@opts); |
114
|
0
|
|
|
|
|
0
|
$self->_debug("using kdialog",2); |
115
|
0
|
|
|
|
|
0
|
last; |
116
|
0
|
|
|
|
|
0
|
} else { next; } |
117
|
|
|
|
|
|
|
} elsif ($try =~ /^GNOME$/i) { |
118
|
0
|
0
|
|
|
|
0
|
if (eval "require UI::Dialog::GNOME; 1") { |
119
|
0
|
|
|
|
|
0
|
require UI::Dialog::GNOME; |
120
|
0
|
|
|
|
|
0
|
$self->{'_ui_dialog'} = new UI::Dialog::GNOME (@opts); |
121
|
0
|
|
|
|
|
0
|
last; |
122
|
0
|
|
|
|
|
0
|
} else { next; } |
123
|
|
|
|
|
|
|
} elsif ($try =~ /^KDE$/i) { |
124
|
0
|
0
|
|
|
|
0
|
if (eval "require UI::Dialog::KDE; 1") { |
125
|
0
|
|
|
|
|
0
|
require UI::Dialog::KDE; |
126
|
0
|
|
|
|
|
0
|
$self->{'_ui_dialog'} = new UI::Dialog::KDE (@opts); |
127
|
0
|
|
|
|
|
0
|
last; |
128
|
0
|
|
|
|
|
0
|
} else { next; } |
129
|
|
|
|
|
|
|
} elsif ($try =~ /^CONSOLE$/i) { |
130
|
0
|
0
|
|
|
|
0
|
if (eval "require UI::Dialog::Console; 1") { |
131
|
0
|
|
|
|
|
0
|
require UI::Dialog::Console; |
132
|
0
|
|
|
|
|
0
|
$self->{'_ui_dialog'} = new UI::Dialog::Console (@opts); |
133
|
0
|
|
|
|
|
0
|
last; |
134
|
0
|
|
|
|
|
0
|
} else { next; } |
135
|
|
|
|
|
|
|
} elsif ($try =~ /^(?:dialog|cdialog)$/i) { |
136
|
1
|
|
|
|
|
3
|
$self->_debug("trying cdialog",2); |
137
|
1
|
50
|
33
|
|
|
61
|
if (eval "require UI::Dialog::Backend::CDialog; 1" && $self->_has_variant('dialog')) { |
138
|
0
|
|
|
|
|
0
|
require UI::Dialog::Backend::CDialog; |
139
|
0
|
|
|
|
|
0
|
$self->{'_ui_dialog'} = new UI::Dialog::Backend::CDialog (@opts); |
140
|
0
|
|
|
|
|
0
|
$self->_debug("using cdialog",2); |
141
|
0
|
|
|
|
|
0
|
last; |
142
|
1
|
|
|
|
|
7
|
} else { next; } |
143
|
|
|
|
|
|
|
} elsif ($try =~ /^whiptail$/i) { |
144
|
1
|
|
|
|
|
7
|
$self->_debug("trying whiptail",2); |
145
|
1
|
50
|
33
|
|
|
62
|
if (eval "require UI::Dialog::Backend::Whiptail; 1" && $self->_has_variant('whiptail')) { |
146
|
1
|
|
|
|
|
6
|
require UI::Dialog::Backend::Whiptail; |
147
|
1
|
|
|
|
|
10
|
$self->{'_ui_dialog'} = new UI::Dialog::Backend::Whiptail (@opts); |
148
|
1
|
|
|
|
|
3
|
$self->_debug("using whiptail",2); |
149
|
1
|
|
|
|
|
2
|
last; |
150
|
0
|
|
|
|
|
0
|
} else { next; } |
151
|
|
|
|
|
|
|
} elsif ($try =~ /^(?:ascii|native)$/i) { |
152
|
0
|
|
|
|
|
0
|
$self->_debug("trying ascii",2); |
153
|
0
|
0
|
|
|
|
0
|
if (eval "require UI::Dialog::Backend::ASCII; 1") { |
154
|
0
|
|
|
|
|
0
|
require UI::Dialog::Backend::ASCII; |
155
|
0
|
|
|
|
|
0
|
$self->{'_ui_dialog'} = new UI::Dialog::Backend::ASCII (@opts); |
156
|
0
|
|
|
|
|
0
|
$self->_debug("using ascii",2); |
157
|
0
|
|
|
|
|
0
|
last; |
158
|
0
|
|
|
|
|
0
|
} else { next; } |
159
|
0
|
|
|
|
|
0
|
} else { next; } |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
} else { |
162
|
0
|
0
|
|
|
|
0
|
if (eval "require UI::Dialog::Backend::ASCII; 1") { |
163
|
0
|
|
|
|
|
0
|
require UI::Dialog::Backend::ASCII; |
164
|
0
|
|
|
|
|
0
|
$self->{'_ui_dialog'} = new UI::Dialog::Backend::ASCII (@opts); |
165
|
|
|
|
|
|
|
} else { |
166
|
0
|
|
|
|
|
0
|
carp("Failed to load any suitable dialog variant backend."); |
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
|
170
|
1
|
50
|
|
|
|
7
|
ref($self->{'_ui_dialog'}) or croak("unable to load suitable backend."); |
171
|
1
|
|
|
|
|
8
|
return($self); |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
175
|
|
|
|
|
|
|
#: Private Methods |
176
|
|
|
|
|
|
|
#: |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
#: purely internal usage |
179
|
|
|
|
|
|
|
sub _debug { |
180
|
6
|
|
|
6
|
|
13
|
my $self = $_[0]; |
181
|
6
|
|
50
|
|
|
15
|
my $mesg = $_[1] || 'null error message given!'; |
182
|
6
|
|
50
|
|
|
13
|
my $rate = $_[2] || 1; |
183
|
6
|
50
|
33
|
|
|
24
|
return() unless $self->{'debug'} and $self->{'debug'} >= $rate; |
184
|
0
|
|
|
|
|
0
|
chomp($mesg); |
185
|
0
|
|
|
|
|
0
|
print STDERR "Debug: ".$mesg."\n"; |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
sub _has_variant { |
189
|
2
|
|
|
2
|
|
5
|
my $self = $_[0]; |
190
|
2
|
|
|
|
|
4
|
my $variant = $_[1]; |
191
|
|
|
|
|
|
|
$self->{'PATHS'} = ((ref($self->{'PATHS'}) eq "ARRAY") ? $self->{'PATHS'} : |
192
|
2
|
0
|
|
|
|
22
|
($self->{'PATHS'}) ? [ $self->{'PATHS'} ] : |
|
|
50
|
|
|
|
|
|
193
|
|
|
|
|
|
|
[ '/bin', '/usr/bin', '/usr/local/bin', '/opt/bin' ]); |
194
|
2
|
|
|
|
|
4
|
foreach my $PATH (@{$self->{'PATHS'}}) { |
|
2
|
|
|
|
|
9
|
|
195
|
13
|
100
|
|
|
|
224
|
return($PATH . '/' . $variant) |
196
|
|
|
|
|
|
|
unless not -x $PATH . '/' . $variant; |
197
|
|
|
|
|
|
|
} |
198
|
1
|
|
|
|
|
7
|
return(0); |
199
|
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
202
|
|
|
|
|
|
|
#: Public Methods |
203
|
|
|
|
|
|
|
#: |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
#: dialog variant state methods: |
206
|
0
|
|
|
0
|
1
|
|
sub state { return(shift()->{'_ui_dialog'}->state(@_)); } |
207
|
0
|
|
|
0
|
1
|
|
sub ra { return(shift()->{'_ui_dialog'}->ra(@_)); } |
208
|
0
|
|
|
0
|
1
|
|
sub rs { return(shift()->{'_ui_dialog'}->rs(@_)); } |
209
|
0
|
|
|
0
|
1
|
|
sub rv { return(shift()->{'_ui_dialog'}->rv(@_)); } |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
#: Frills |
212
|
|
|
|
|
|
|
#: all backends support nautilus scripts. |
213
|
0
|
|
|
0
|
0
|
|
sub nautilus { return(shift()->{'_ui_dialog'}->nautilus(@_)); } |
214
|
|
|
|
|
|
|
#: same with osd_cat (aka: xosd). |
215
|
0
|
|
|
0
|
0
|
|
sub xosd { return(shift()->{'_ui_dialog'}->xosd(@_)); } |
216
|
|
|
|
|
|
|
#: Beep & Clear may have no affect when using GUI backends |
217
|
0
|
|
|
0
|
0
|
|
sub beep { return(shift()->{'_ui_dialog'}->beep(@_)); } |
218
|
0
|
|
|
0
|
0
|
|
sub clear { return(shift()->{'_ui_dialog'}->clear(@_)); } |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
#: widget methods: |
221
|
0
|
|
|
0
|
1
|
|
sub yesno { return(shift()->{'_ui_dialog'}->yesno(@_)); } |
222
|
0
|
|
|
0
|
1
|
|
sub msgbox { return(shift()->{'_ui_dialog'}->msgbox(@_)); } |
223
|
0
|
|
|
0
|
1
|
|
sub inputbox { return(shift()->{'_ui_dialog'}->inputbox(@_)); } |
224
|
0
|
|
|
0
|
1
|
|
sub password { return(shift()->{'_ui_dialog'}->password(@_)); } |
225
|
0
|
|
|
0
|
1
|
|
sub textbox { return(shift()->{'_ui_dialog'}->textbox(@_)); } |
226
|
0
|
|
|
0
|
1
|
|
sub menu { return(shift()->{'_ui_dialog'}->menu(@_)); } |
227
|
0
|
|
|
0
|
1
|
|
sub checklist { return(shift()->{'_ui_dialog'}->checklist(@_)); } |
228
|
0
|
|
|
0
|
1
|
|
sub radiolist { return(shift()->{'_ui_dialog'}->radiolist(@_)); } |
229
|
0
|
|
|
0
|
1
|
|
sub fselect { return(shift()->{'_ui_dialog'}->fselect(@_)); } |
230
|
0
|
|
|
0
|
1
|
|
sub dselect { return(shift()->{'_ui_dialog'}->dselect(@_)); } |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
1; |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=head1 NAME |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
UI::Dialog - wrapper for various dialog applications. |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
=head1 SYNOPSIS |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
use UI::Dialog; |
241
|
|
|
|
|
|
|
my $d = new UI::Dialog ( backtitle => 'Demo', title => 'Default', |
242
|
|
|
|
|
|
|
height => 20, width => 65 , listheight => 5, |
243
|
|
|
|
|
|
|
order => [ 'zenity', 'xdialog' ] ); |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
# Either a Zenity or Xdialog msgbox widget should popup, |
246
|
|
|
|
|
|
|
# with a preference for Zenity. |
247
|
|
|
|
|
|
|
$d->msgbox( title => 'Welcome!', text => 'Welcome one and all!' ); |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
=head1 ABSTRACT |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
UI::Dialog is a OOPerl wrapper for the various dialog applications. These |
252
|
|
|
|
|
|
|
dialog backends are currently supported: Zenity, XDialog, GDialog, KDialog, |
253
|
|
|
|
|
|
|
CDialog, and Whiptail. There is also an ASCII backend provided as a last |
254
|
|
|
|
|
|
|
resort interface for the console based dialog variants. UI::Dialog is a |
255
|
|
|
|
|
|
|
class that provides a strict interface to these various backend modules. |
256
|
|
|
|
|
|
|
By using UI:Dialog (with it's imposed limitations on the widgets) you can |
257
|
|
|
|
|
|
|
ensure that your Perl program will function with any available interfaces. |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=head1 DESCRIPTION |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
UI::Dialog supports priority ordering of the backend detection process. So |
262
|
|
|
|
|
|
|
if you'd prefer that Xdialog should be used first if available, simply |
263
|
|
|
|
|
|
|
designate the desired order when creating the new object. The default order |
264
|
|
|
|
|
|
|
for detecting and utilization of the backends are as follows: |
265
|
|
|
|
|
|
|
(with DISPLAY env): Zenity, GDialog, XDialog, KDialog |
266
|
|
|
|
|
|
|
(without DISPLAY): CDialog, Whiptail, ASCII |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
UI::Dialog is the result of a complete re-write of the UDPM CPAN module. This |
269
|
|
|
|
|
|
|
was done to break away from the bad choice of name (UserDialogPerlModule) and |
270
|
|
|
|
|
|
|
to implement a cleaner, more detached, OOPerl interface. |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
=head1 EXPORT |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
=over 2 |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
None |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
=back |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
=head1 INHERITS |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
=over 2 |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
None |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
=back |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
=over 2 |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
=back |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
=head2 new( @options ) |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
=over 4 |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
=item EXAMPLE |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
=over 6 |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
my $d = new( title => 'Default Title', backtitle => 'Backtitle', |
303
|
|
|
|
|
|
|
width => 65, height => 20, listheight => 5, |
304
|
|
|
|
|
|
|
order => [ 'zenity', 'xdialog', 'gdialog' ] ); |
305
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
=back |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
=item DESCRIPTION |
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
=over 6 |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
This is the Class Constructor method. It accepts a list of key => value pairs |
313
|
|
|
|
|
|
|
and uses them as the defaults when interacting with the various widgets. |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
=back |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
=item RETURNS |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
=over 6 |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
A blessed object reference of the UI::Dialog class. |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
=back |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
=item OPTIONS |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
The (...)'s after each option indicate the default for the option. An * denotes |
328
|
|
|
|
|
|
|
support by all the widget methods on a per-use policy defaulting to the values |
329
|
|
|
|
|
|
|
decided during object creation. |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
=over 6 |
332
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
=item B (0) |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
=item B (as indicated) |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
=item B (as indicated) |
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
=item B ('') * |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
=item B ('') * |
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
=item B (0) * |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
=item B (0) * |
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
=item B (20) * |
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
=item B (65) * |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
=item B (5) * |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
=back |
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
=back |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
=head1 STATE METHODS |
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
=over 2 |
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
=back |
362
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
=head2 state( ) |
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
=over 4 |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
=item EXAMPLE |
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
=over 6 |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
if ($d->state() eq "OK") { |
372
|
|
|
|
|
|
|
$d->msgbox( text => "that went well" ); |
373
|
|
|
|
|
|
|
} |
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
=back |
376
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
=item DESCRIPTION |
378
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
=over 6 |
380
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
Returns the state of the last dialog widget command. The value can be one of |
382
|
|
|
|
|
|
|
"OK", "CANCEL", "ESC". The return data is based on the exit codes (return value) of the |
383
|
|
|
|
|
|
|
last widget displayed. |
384
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
=back |
386
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
=item RETURNS |
388
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
=over 6 |
390
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
a single SCALAR. |
392
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
=back |
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
=back |
396
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
=over 2 |
398
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
=back |
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
=head2 ra( ) |
402
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
=over 4 |
404
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
=item EXAMPLE |
406
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
=over 6 |
408
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
my @array = $d->ra(); |
410
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
=back |
412
|
|
|
|
|
|
|
|
413
|
|
|
|
|
|
|
=item DESCRIPTION |
414
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
=over 6 |
416
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
Returns the last widget's data as an array. |
418
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
=back |
420
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
=item RETURNS |
422
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
=over 6 |
424
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
an ARRAY. |
426
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
=back |
428
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
=back |
430
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
=over 2 |
432
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
=back |
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
=head2 rs( ) |
436
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
=over 4 |
438
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
=item EXAMPLE |
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
=over 6 |
442
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
my $string = $d->rs(); |
444
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
=back |
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
=item DESCRIPTION |
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
=over 6 |
450
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
Returns the last widget's data as a (possibly multiline) string. |
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
=back |
454
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
=item RETURNS |
456
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
=over 6 |
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
a SCALAR. |
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
=back |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
=back |
464
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
=over 2 |
466
|
|
|
|
|
|
|
|
467
|
|
|
|
|
|
|
=back |
468
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
=head2 rv( ) |
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
=over 4 |
472
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
=item EXAMPLE |
474
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
=over 6 |
476
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
my $string = $d->rv(); |
478
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
=back |
480
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
=item DESCRIPTION |
482
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
=over 6 |
484
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
Returns the last widget's exit status, aka: return value. |
486
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
=back |
488
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
=item RETURNS |
490
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
=over 6 |
492
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
a SCALAR. |
494
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
=back |
496
|
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
=back |
498
|
|
|
|
|
|
|
|
499
|
|
|
|
|
|
|
=head1 WIDGET METHODS |
500
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
=over 2 |
502
|
|
|
|
|
|
|
|
503
|
|
|
|
|
|
|
=back |
504
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
=head2 yesno( ) |
506
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
=over 4 |
508
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
=item EXAMPLE |
510
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
=over 6 |
512
|
|
|
|
|
|
|
|
513
|
|
|
|
|
|
|
if ($d->yesno( text => 'A binary type question?') ) { |
514
|
|
|
|
|
|
|
# user pressed yes |
515
|
|
|
|
|
|
|
} else { |
516
|
|
|
|
|
|
|
# user pressed no or cancel |
517
|
|
|
|
|
|
|
} |
518
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
=back |
520
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
=item DESCRIPTION |
522
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
=over 6 |
524
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
Present the end user with a message box that has two buttons, yes and no. |
526
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
=back |
528
|
|
|
|
|
|
|
|
529
|
|
|
|
|
|
|
=item RETURNS |
530
|
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
=over 6 |
532
|
|
|
|
|
|
|
|
533
|
|
|
|
|
|
|
TRUE (1) for a response of YES or FALSE (0) for anything else. |
534
|
|
|
|
|
|
|
|
535
|
|
|
|
|
|
|
=back |
536
|
|
|
|
|
|
|
|
537
|
|
|
|
|
|
|
=back |
538
|
|
|
|
|
|
|
|
539
|
|
|
|
|
|
|
=over 2 |
540
|
|
|
|
|
|
|
|
541
|
|
|
|
|
|
|
=back |
542
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
=head2 msgbox( ) |
544
|
|
|
|
|
|
|
|
545
|
|
|
|
|
|
|
=over 4 |
546
|
|
|
|
|
|
|
|
547
|
|
|
|
|
|
|
=item EXAMPLE |
548
|
|
|
|
|
|
|
|
549
|
|
|
|
|
|
|
=over 6 |
550
|
|
|
|
|
|
|
|
551
|
|
|
|
|
|
|
$d->msgbox( text => 'A simple message' ); |
552
|
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
=back |
554
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
=item DESCRIPTION |
556
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
=over 6 |
558
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
Pesent the end user with a message box that has an OK button. |
560
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
=back |
562
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
=item RETURNS |
564
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
=over 6 |
566
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
TRUE (1) for a response of OK or FALSE (0) for anything else. |
568
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
=back |
570
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
=back |
572
|
|
|
|
|
|
|
|
573
|
|
|
|
|
|
|
=over 2 |
574
|
|
|
|
|
|
|
|
575
|
|
|
|
|
|
|
=back |
576
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
=head2 inputbox( ) |
578
|
|
|
|
|
|
|
|
579
|
|
|
|
|
|
|
=over 4 |
580
|
|
|
|
|
|
|
|
581
|
|
|
|
|
|
|
=item EXAMPLE |
582
|
|
|
|
|
|
|
|
583
|
|
|
|
|
|
|
=over 6 |
584
|
|
|
|
|
|
|
|
585
|
|
|
|
|
|
|
my $string = $d->inputbox( text => 'Please enter some text...', |
586
|
|
|
|
|
|
|
entry => 'this is the input field' ); |
587
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
=back |
589
|
|
|
|
|
|
|
|
590
|
|
|
|
|
|
|
=item DESCRIPTION |
591
|
|
|
|
|
|
|
|
592
|
|
|
|
|
|
|
=over 6 |
593
|
|
|
|
|
|
|
|
594
|
|
|
|
|
|
|
Present the end user with a text input field and a message. |
595
|
|
|
|
|
|
|
|
596
|
|
|
|
|
|
|
=back |
597
|
|
|
|
|
|
|
|
598
|
|
|
|
|
|
|
=item RETURNS |
599
|
|
|
|
|
|
|
|
600
|
|
|
|
|
|
|
=over 6 |
601
|
|
|
|
|
|
|
|
602
|
|
|
|
|
|
|
a SCALAR if the response is OK and FALSE (0) for anything else. |
603
|
|
|
|
|
|
|
|
604
|
|
|
|
|
|
|
=back |
605
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
=back |
607
|
|
|
|
|
|
|
|
608
|
|
|
|
|
|
|
=over 2 |
609
|
|
|
|
|
|
|
|
610
|
|
|
|
|
|
|
=back |
611
|
|
|
|
|
|
|
|
612
|
|
|
|
|
|
|
=head2 password( ) |
613
|
|
|
|
|
|
|
|
614
|
|
|
|
|
|
|
=over 4 |
615
|
|
|
|
|
|
|
|
616
|
|
|
|
|
|
|
=item EXAMPLE |
617
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
=over 6 |
619
|
|
|
|
|
|
|
|
620
|
|
|
|
|
|
|
my $string = $d->password( text => 'Enter some hidden text.' ); |
621
|
|
|
|
|
|
|
|
622
|
|
|
|
|
|
|
=back |
623
|
|
|
|
|
|
|
|
624
|
|
|
|
|
|
|
=item DESCRIPTION |
625
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
=over 6 |
627
|
|
|
|
|
|
|
|
628
|
|
|
|
|
|
|
Present the end user with a text input field, that has hidden input, and a message. |
629
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
Note that the GDialog backend will provide a regular inputbox instead of a password |
631
|
|
|
|
|
|
|
box because gdialog doesn't support passwords. GDialog is on it's way to the proverbial |
632
|
|
|
|
|
|
|
software heaven so this isn't a real problem. Use Zenity instead :) |
633
|
|
|
|
|
|
|
|
634
|
|
|
|
|
|
|
=back |
635
|
|
|
|
|
|
|
|
636
|
|
|
|
|
|
|
=item RETURNS |
637
|
|
|
|
|
|
|
|
638
|
|
|
|
|
|
|
=over 6 |
639
|
|
|
|
|
|
|
|
640
|
|
|
|
|
|
|
a SCALAR if the response is OK and FALSE (0) for anything else. |
641
|
|
|
|
|
|
|
|
642
|
|
|
|
|
|
|
=back |
643
|
|
|
|
|
|
|
|
644
|
|
|
|
|
|
|
=back |
645
|
|
|
|
|
|
|
|
646
|
|
|
|
|
|
|
=over 2 |
647
|
|
|
|
|
|
|
|
648
|
|
|
|
|
|
|
=back |
649
|
|
|
|
|
|
|
|
650
|
|
|
|
|
|
|
=head2 textbox( ) |
651
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
=over 4 |
653
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
=item EXAMPLE |
655
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
=over 6 |
657
|
|
|
|
|
|
|
|
658
|
|
|
|
|
|
|
$d->textbox( path => '/path/to/a/text/file' ); |
659
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
=back |
661
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
=item DESCRIPTION |
663
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
=over 6 |
665
|
|
|
|
|
|
|
|
666
|
|
|
|
|
|
|
Present the end user with a simple scrolling box containing the contents |
667
|
|
|
|
|
|
|
of the given text file. |
668
|
|
|
|
|
|
|
|
669
|
|
|
|
|
|
|
=back |
670
|
|
|
|
|
|
|
|
671
|
|
|
|
|
|
|
=item RETURNS |
672
|
|
|
|
|
|
|
|
673
|
|
|
|
|
|
|
=over 6 |
674
|
|
|
|
|
|
|
|
675
|
|
|
|
|
|
|
TRUE (1) if the response is OK and FALSE (0) for anything else. |
676
|
|
|
|
|
|
|
|
677
|
|
|
|
|
|
|
=back |
678
|
|
|
|
|
|
|
|
679
|
|
|
|
|
|
|
=back |
680
|
|
|
|
|
|
|
|
681
|
|
|
|
|
|
|
=over 2 |
682
|
|
|
|
|
|
|
|
683
|
|
|
|
|
|
|
=back |
684
|
|
|
|
|
|
|
|
685
|
|
|
|
|
|
|
=head2 menu( ) |
686
|
|
|
|
|
|
|
|
687
|
|
|
|
|
|
|
=over 4 |
688
|
|
|
|
|
|
|
|
689
|
|
|
|
|
|
|
=item EXAMPLE |
690
|
|
|
|
|
|
|
|
691
|
|
|
|
|
|
|
=over 6 |
692
|
|
|
|
|
|
|
|
693
|
|
|
|
|
|
|
my $selection1 = $d->menu( text => 'Select one:', |
694
|
|
|
|
|
|
|
list => [ 'tag1', 'item1', |
695
|
|
|
|
|
|
|
'tag2', 'item2', |
696
|
|
|
|
|
|
|
'tag3', 'item3' ] ); |
697
|
|
|
|
|
|
|
|
698
|
|
|
|
|
|
|
=back |
699
|
|
|
|
|
|
|
|
700
|
|
|
|
|
|
|
=item DESCRIPTION |
701
|
|
|
|
|
|
|
|
702
|
|
|
|
|
|
|
=over 6 |
703
|
|
|
|
|
|
|
|
704
|
|
|
|
|
|
|
Present the user with a selectable list. |
705
|
|
|
|
|
|
|
|
706
|
|
|
|
|
|
|
=back |
707
|
|
|
|
|
|
|
|
708
|
|
|
|
|
|
|
=item RETURNS |
709
|
|
|
|
|
|
|
|
710
|
|
|
|
|
|
|
=over 6 |
711
|
|
|
|
|
|
|
|
712
|
|
|
|
|
|
|
a SCALAR of the chosen tag if the response is OK and FALSE (0) for |
713
|
|
|
|
|
|
|
anything else. |
714
|
|
|
|
|
|
|
|
715
|
|
|
|
|
|
|
=back |
716
|
|
|
|
|
|
|
|
717
|
|
|
|
|
|
|
=back |
718
|
|
|
|
|
|
|
|
719
|
|
|
|
|
|
|
=over 2 |
720
|
|
|
|
|
|
|
|
721
|
|
|
|
|
|
|
=back |
722
|
|
|
|
|
|
|
|
723
|
|
|
|
|
|
|
=head2 checklist( ) |
724
|
|
|
|
|
|
|
|
725
|
|
|
|
|
|
|
=over 4 |
726
|
|
|
|
|
|
|
|
727
|
|
|
|
|
|
|
=item EXAMPLE |
728
|
|
|
|
|
|
|
|
729
|
|
|
|
|
|
|
=over 6 |
730
|
|
|
|
|
|
|
|
731
|
|
|
|
|
|
|
my @selection1 = $d->checklist( text => 'Select one:', |
732
|
|
|
|
|
|
|
list => [ 'tag1', [ 'item1', 0 ], |
733
|
|
|
|
|
|
|
'tag2', [ 'item2', 1 ], |
734
|
|
|
|
|
|
|
'tag3', [ 'item3', 1 ] ] |
735
|
|
|
|
|
|
|
); |
736
|
|
|
|
|
|
|
|
737
|
|
|
|
|
|
|
=back |
738
|
|
|
|
|
|
|
|
739
|
|
|
|
|
|
|
=item DESCRIPTION |
740
|
|
|
|
|
|
|
|
741
|
|
|
|
|
|
|
=over 6 |
742
|
|
|
|
|
|
|
|
743
|
|
|
|
|
|
|
Present the user with a selectable checklist. |
744
|
|
|
|
|
|
|
|
745
|
|
|
|
|
|
|
=back |
746
|
|
|
|
|
|
|
|
747
|
|
|
|
|
|
|
=item RETURNS |
748
|
|
|
|
|
|
|
|
749
|
|
|
|
|
|
|
=over 6 |
750
|
|
|
|
|
|
|
|
751
|
|
|
|
|
|
|
an ARRAY of the chosen tags if the response is OK and FALSE (0) for |
752
|
|
|
|
|
|
|
anything else. |
753
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
=back |
755
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
=back |
757
|
|
|
|
|
|
|
|
758
|
|
|
|
|
|
|
=over 2 |
759
|
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
=back |
761
|
|
|
|
|
|
|
|
762
|
|
|
|
|
|
|
=head2 radiolist( ) |
763
|
|
|
|
|
|
|
|
764
|
|
|
|
|
|
|
=over 4 |
765
|
|
|
|
|
|
|
|
766
|
|
|
|
|
|
|
=item EXAMPLE |
767
|
|
|
|
|
|
|
|
768
|
|
|
|
|
|
|
=over 6 |
769
|
|
|
|
|
|
|
|
770
|
|
|
|
|
|
|
my $selection1 = $d->radiolist( text => 'Select one:', |
771
|
|
|
|
|
|
|
list => [ 'tag1', [ 'item1', 0 ], |
772
|
|
|
|
|
|
|
'tag2', [ 'item2', 1 ], |
773
|
|
|
|
|
|
|
'tag3', [ 'item3', 0 ] ] |
774
|
|
|
|
|
|
|
); |
775
|
|
|
|
|
|
|
|
776
|
|
|
|
|
|
|
=back |
777
|
|
|
|
|
|
|
|
778
|
|
|
|
|
|
|
=item DESCRIPTION |
779
|
|
|
|
|
|
|
|
780
|
|
|
|
|
|
|
=over 6 |
781
|
|
|
|
|
|
|
|
782
|
|
|
|
|
|
|
Present the user with a selectable radiolist. |
783
|
|
|
|
|
|
|
|
784
|
|
|
|
|
|
|
=back |
785
|
|
|
|
|
|
|
|
786
|
|
|
|
|
|
|
=item RETURNS |
787
|
|
|
|
|
|
|
|
788
|
|
|
|
|
|
|
=over 6 |
789
|
|
|
|
|
|
|
|
790
|
|
|
|
|
|
|
a SCALAR of the chosen tag if the response is OK and FALSE (0) for |
791
|
|
|
|
|
|
|
anything else. |
792
|
|
|
|
|
|
|
|
793
|
|
|
|
|
|
|
=back |
794
|
|
|
|
|
|
|
|
795
|
|
|
|
|
|
|
=back |
796
|
|
|
|
|
|
|
|
797
|
|
|
|
|
|
|
=over 2 |
798
|
|
|
|
|
|
|
|
799
|
|
|
|
|
|
|
=back |
800
|
|
|
|
|
|
|
|
801
|
|
|
|
|
|
|
=head2 fselect( ) |
802
|
|
|
|
|
|
|
|
803
|
|
|
|
|
|
|
=over 4 |
804
|
|
|
|
|
|
|
|
805
|
|
|
|
|
|
|
=item EXAMPLE |
806
|
|
|
|
|
|
|
|
807
|
|
|
|
|
|
|
=over 6 |
808
|
|
|
|
|
|
|
|
809
|
|
|
|
|
|
|
my $text = $d->fselect( path => '/path/to/a/file/or/directory' ); |
810
|
|
|
|
|
|
|
|
811
|
|
|
|
|
|
|
=back |
812
|
|
|
|
|
|
|
|
813
|
|
|
|
|
|
|
=item DESCRIPTION |
814
|
|
|
|
|
|
|
|
815
|
|
|
|
|
|
|
=over 6 |
816
|
|
|
|
|
|
|
|
817
|
|
|
|
|
|
|
Present the user with a file selection widget preset with the given path. |
818
|
|
|
|
|
|
|
|
819
|
|
|
|
|
|
|
=back |
820
|
|
|
|
|
|
|
|
821
|
|
|
|
|
|
|
=item RETURNS |
822
|
|
|
|
|
|
|
|
823
|
|
|
|
|
|
|
=over 6 |
824
|
|
|
|
|
|
|
|
825
|
|
|
|
|
|
|
a SCALAR if the response is OK and FALSE (0) for anything else. |
826
|
|
|
|
|
|
|
|
827
|
|
|
|
|
|
|
=back |
828
|
|
|
|
|
|
|
|
829
|
|
|
|
|
|
|
=back |
830
|
|
|
|
|
|
|
|
831
|
|
|
|
|
|
|
=over 2 |
832
|
|
|
|
|
|
|
|
833
|
|
|
|
|
|
|
=back |
834
|
|
|
|
|
|
|
|
835
|
|
|
|
|
|
|
=head2 dselect( ) |
836
|
|
|
|
|
|
|
|
837
|
|
|
|
|
|
|
=over 4 |
838
|
|
|
|
|
|
|
|
839
|
|
|
|
|
|
|
=item EXAMPLE |
840
|
|
|
|
|
|
|
|
841
|
|
|
|
|
|
|
=over 6 |
842
|
|
|
|
|
|
|
|
843
|
|
|
|
|
|
|
my $text = $d->dselect( path => '/path/to/a/file/or/directory' ); |
844
|
|
|
|
|
|
|
|
845
|
|
|
|
|
|
|
=back |
846
|
|
|
|
|
|
|
|
847
|
|
|
|
|
|
|
=item DESCRIPTION |
848
|
|
|
|
|
|
|
|
849
|
|
|
|
|
|
|
=over 6 |
850
|
|
|
|
|
|
|
|
851
|
|
|
|
|
|
|
Present the user with a file selection widget preset with the given path. |
852
|
|
|
|
|
|
|
Unlike fselect() this widget will only return a directory selection. |
853
|
|
|
|
|
|
|
|
854
|
|
|
|
|
|
|
=back |
855
|
|
|
|
|
|
|
|
856
|
|
|
|
|
|
|
=item RETURNS |
857
|
|
|
|
|
|
|
|
858
|
|
|
|
|
|
|
=over 6 |
859
|
|
|
|
|
|
|
|
860
|
|
|
|
|
|
|
a SCALAR if the response is OK and FALSE (0) for anything else. |
861
|
|
|
|
|
|
|
|
862
|
|
|
|
|
|
|
=back |
863
|
|
|
|
|
|
|
|
864
|
|
|
|
|
|
|
=back |
865
|
|
|
|
|
|
|
|
866
|
|
|
|
|
|
|
=head1 SEE ALSO |
867
|
|
|
|
|
|
|
|
868
|
|
|
|
|
|
|
=over 2 |
869
|
|
|
|
|
|
|
|
870
|
|
|
|
|
|
|
=item PERLDOC |
871
|
|
|
|
|
|
|
|
872
|
|
|
|
|
|
|
UI::Dialog::GNOME |
873
|
|
|
|
|
|
|
UI::Dialog::KDE |
874
|
|
|
|
|
|
|
UI::Dialog::Console |
875
|
|
|
|
|
|
|
UI::Dialog::Backend |
876
|
|
|
|
|
|
|
UI::Dialog::Backend::ASCII |
877
|
|
|
|
|
|
|
UI::Dialog::Backend::CDialog |
878
|
|
|
|
|
|
|
UI::Dialog::Backend::GDialog |
879
|
|
|
|
|
|
|
UI::Dialog::Backend::KDialog |
880
|
|
|
|
|
|
|
UI::Dialog::Backend::Nautilus |
881
|
|
|
|
|
|
|
UI::Dialog::Backend::Whiptail |
882
|
|
|
|
|
|
|
UI::Dialog::Backend::XDialog |
883
|
|
|
|
|
|
|
UI::Dialog::Backend::XOSD |
884
|
|
|
|
|
|
|
UI::Dialog::Backend::Zenity |
885
|
|
|
|
|
|
|
|
886
|
|
|
|
|
|
|
=back |
887
|
|
|
|
|
|
|
|
888
|
|
|
|
|
|
|
=over 2 |
889
|
|
|
|
|
|
|
|
890
|
|
|
|
|
|
|
=item MAN FILES |
891
|
|
|
|
|
|
|
|
892
|
|
|
|
|
|
|
dialog(1), whiptail(1), zenity(1), gdialog(1), Xdialog(1), |
893
|
|
|
|
|
|
|
osd_cat(1), kdialog(1) and nautilus(1) |
894
|
|
|
|
|
|
|
|
895
|
|
|
|
|
|
|
=back |
896
|
|
|
|
|
|
|
|
897
|
|
|
|
|
|
|
=head1 BUGS |
898
|
|
|
|
|
|
|
|
899
|
|
|
|
|
|
|
Please email the author with any bug reports. Include the name of the |
900
|
|
|
|
|
|
|
module in the subject line. |
901
|
|
|
|
|
|
|
|
902
|
|
|
|
|
|
|
=head1 AUTHOR |
903
|
|
|
|
|
|
|
|
904
|
|
|
|
|
|
|
Kevin C. Krinke, Ekevin@krinke.caE |
905
|
|
|
|
|
|
|
|
906
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
907
|
|
|
|
|
|
|
|
908
|
|
|
|
|
|
|
Copyright (C) 2015 Kevin C. Krinke |
909
|
|
|
|
|
|
|
|
910
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or |
911
|
|
|
|
|
|
|
modify it under the terms of the GNU Lesser General Public |
912
|
|
|
|
|
|
|
License as published by the Free Software Foundation; either |
913
|
|
|
|
|
|
|
version 2.1 of the License, or (at your option) any later version. |
914
|
|
|
|
|
|
|
|
915
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful, |
916
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
917
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
918
|
|
|
|
|
|
|
Lesser General Public License for more details. |
919
|
|
|
|
|
|
|
|
920
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public |
921
|
|
|
|
|
|
|
License along with this library; if not, write to the Free Software |
922
|
|
|
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
923
|
|
|
|
|
|
|
|
924
|
|
|
|
|
|
|
=cut |