3
UI::Dialog::Backend::Whiptail
7
use UI::Dialog::Backend::Whiptail;
8
my $d = new UI::Dialog::Backend::Whiptail ( backtitle => 'Demo',
11
$d->msgbox( title => 'Welcome!', text => 'Welcome one and all!' );
15
UI::Dialog::Backend::Whiptail is the UI::Dialog backend for the Whiptail
16
dialog variant. While this module is used through UI::Dialog or any other loader
17
module only the compatible methods are ever accessible. However, when using
18
this module directly in your application (as in the SYNOPSIS example) you are
19
given access to all the options and features of the real whiptail(1) application.
23
This dialog variant is the staple of the Debian console apt/dpkg interface. There
24
isn't very much interesting about this particular backend. This is very much a
25
basic dialog variant in comparison to things like Xdialog and cDialog.
45
=head2 new( @options )
53
my $d = new( title => 'Default Title', backtitle => 'Backtitle',
54
width => 65, height => 20, listheight => 5 );
62
This is the Class Constructor method. It accepts a list of key => value pairs
63
and uses them as the defaults when interacting with the various widgets.
71
A blessed object reference of the UI::Dialog::Backend::Whiptail class.
77
The (...)'s after each option indicate the default for the option. An * denotes
78
support by all the widget methods on a per-use policy defaulting to the values
79
decided during object creation.
83
=item B<debug = 0,1,2> (0)
85
=item B<literal = 0,1> (0)
87
=item B<backtitle = "backtitle"> ('') *
89
=item B<title = "title"> ('') *
91
=item B<height = \d+> (0) *
93
=item B<listheight = \d+> (5) *
95
=item B<width = \d+> (0) *
97
=item B<beepbefore = 0,1> (0) *
99
=item B<beepafter = 0,1> (0) *
105
=head1 WIDGET METHODS
115
if ($d->yesno( text => 'A binary type question?') ) {
118
# user pressed no or cancel
127
Present the end user with a message box that has two buttons, yes and no.
135
TRUE (1) for a response of YES or FALSE (0) for anything else.
149
$d->msgbox( text => 'A simple message' );
157
Pesent the end user with a message box that has an OK button.
165
TRUE (1) for a response of OK or FALSE (0) for anything else.
179
$d->infobox( text => 'A simple 6 second message.', timeout => 6000 );
187
Pesent the end user with a message box for a limited duration of time. The
188
timeout is specified in thousandths of a second, ie: 1000 = 1 second.
196
TRUE (1) for a response of OK or FALSE (0) for anything else.
210
my $string = $d->password( text => 'Enter some (hidden) text.' );
218
Present the end user with a text input field that doesn't reveal the input
219
(except to the script) and a message.
227
a SCALAR if the response is OK and FALSE (0) for anything else.
241
my $string = $d->inputbox( text => 'Enter some text.',
242
entry => 'this is the input field' );
250
Present the end user with a text input field and a message.
258
a SCALAR if the response is OK and FALSE (0) for anything else.
272
$d->textbox( path => '/path/to/a/text/file' );
280
Present the end user with a simple scrolling box containing the contents
281
of the given text file.
289
TRUE (1) if the response is OK and FALSE (0) for anything else.
303
my $selection1 = $d->menu( text => 'Select one:',
304
list => [ 'tag1', 'item1',
315
Present the user with a selectable list.
323
a SCALAR of the chosen tag if the response is OK and FALSE (0) for
338
my @selection = $d->checklist( text => 'Select one:',
339
list => [ 'tag1', [ 'item1', 0 ],
340
'tag2', [ 'item2', 1 ],
341
'tag3', [ 'item3', 1 ] ]
350
Present the user with a selectable checklist.
358
an ARRAY of the chosen tags if the response is OK and FALSE (0) for
373
my $selection = $d->radiolist( text => 'Select one:',
374
list => [ 'tag1', [ 'item1', 0 ],
375
'tag2', [ 'item2', 1 ],
376
'tag3', [ 'item3', 0 ] ]
385
Present the user with a selectable radiolist.
393
a SCALAR of the chosen tag if the response is OK and FALSE (0) for
408
my $text = $d->fselect( path => '/path/to/a/file/or/directory' );
416
Present the user with a file selection widget preset with the given path.
424
a SCALAR if the response is OK and FALSE (0) for anything else.
438
my $text = $d->dselect( path => '/path/to/a/directory' );
446
Present the user with a file selection widget preset with the given path.
447
Unlike fselect() this widget will only return a directory selection.
455
a SCALAR if the response is OK and FALSE (0) for anything else.
461
=head2 gauge_start( )
469
$d->gauge_start( text => 'gauge...', percentage => 1 );
477
Display a meter bar to the user. This get's the widget realized but requires
478
the use of the other gauge_*() methods for functionality.
486
TRUE (1) if the widget loaded fine and FALSE (0) for anything else.
508
Increment the meter by the given amount.
516
TRUE (1) if the widget incremented fine and FALSE (0) for anything else.
538
Decrement the meter by the given amount.
546
TRUE (1) if the widget incremented fine and FALSE (0) for anything else.
568
Set the meter bar to the given amount.
576
TRUE (1) if the widget set fine and FALSE (0) for anything else.
590
$d->gauge_text( 'string' );
598
Set the meter bar message to the given string.
606
TRUE (1) if the widget set fine and FALSE (0) for anything else.
628
End the meter bar widget process.
636
TRUE (1) if the widget closed fine and FALSE (0) for anything else.
664
Please email the author with any bug reports. Include the name of the
665
module in the subject line.
669
Kevin C. Krinke, E<lt>kevin@krinke.caE<gt>
671
=head1 COPYRIGHT AND LICENSE
673
Copyright (C) 2013 Kevin C. Krinke <kevin@krinke.ca>
675
This library is free software; you can redistribute it and/or
676
modify it under the terms of the GNU Lesser General Public
677
License as published by the Free Software Foundation; either
678
version 2.1 of the License, or (at your option) any later version.
680
This library is distributed in the hope that it will be useful,
681
but WITHOUT ANY WARRANTY; without even the implied warranty of
682
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
683
Lesser General Public License for more details.
685
You should have received a copy of the GNU Lesser General Public
686
License along with this library; if not, write to the Free Software
687
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA