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