Esmith::console
Jump to navigation
Jump to search
esmith::console(3) User Contributed Perl Documentation esmith::console(3)
NAME
esmith::console - A class to provide a backend library to the server console.
SYNOPSIS
use esmith::console;
my $console = esmith::console->new();
($rc, $choice) = $console->message_page ( title => gettext("Administrator password not set"), text => gettext("Sorry, you must set the administrator password."), );
DESCRIPTION
This class provides a backend library of methods for the frontend console on the server. The intent is that all of the whiptail code is hidden in this library, and the frontend can just concern itself with the logical progression through any and all applicable screens.
Methods
new This is the class constructor.
screen and dialog These method are wrappers around whiptail and dialog, and permit the creation of custom screens depending on the arguments passed. They are typically not called directly, but are used by all of the other page methods that follow. You should only call these method directly if none of the other methods apply.
backtitle Console header line for each page
message_page This method should be used whenever a screen that displays a simple message is required.
tryagain_page This method displays a simple "try again" screen.
password_page This method displays a screen suitable for entering a password.
yesno_page This method displays a simple yes/no screen, so the user can make a simple binary selection.
input_page This method displays a simple input screen with an input box.
infobox This method is similar to a messagebox, but exits immediately, without clearing the screen.
textbox A text box lets you display the contents of a text file in a dialog box. It is like a simple text file viewer.
menu_page This method displays a screen with a menu.
keep_option ??
gauge This method displays a progress bar. It takes a coderef as parameter, and uses the coderef to drive the --gauge widget of the dialog program, as well as to perform whatever actions are being reported by the progress bar. The coderef should take one parameter, which is the file handle to write the controlling text to. If the return value of the coderef is defined, it is displayed by a message_page after the progress bar terminates.
All text used to update the progress bar should either be numbers between 0 and 100, or arbitrary text sandwiched between leading and training lines of ’XXX’ followed by newline. The numbers will update the percentage complete of the display, and the text will update the displayed text. Updating the displayed text will reset the precentage complete to 0, so text should always be followed by number.
run_screens This method takes a directory of screens to run, and runs them in order. To support navigation between screens, this method respects an integer return value from the screens.
0 = all is well, continue to the next screen 1 = all is not well, go back to the previous screen 2 = catastrophic failure - return from run_screen
AUTHOR
SME Server Developers <smebugs@mitel.com>
perl v5.10.1 2014-04-05 esmith::console(3)