1 The Command-Line User Interface Term::Clui 2 3 NEW ! Now with mouse ! 4 NEW ! Now with speech ! 5 6Term::Clui offers a high-level user interface, with subroutines &choose 7&ask &edit &view &confirm and &sorry. It works at a higher level than 8widgets; it gives command-line applications a consistent "look and feel". 9Its metaphor for the computer is a human-like conversation-partner, 10and as each answer/response is completed it is summarised onto one line, 11and remains on screen, so that the history of the dialogue gradually 12accumulates on the screen and is available for review, or for cut/paste. 13Also included is the file-selector module Term::Clui::FileSelect, 14with its main subroutine &select_file. Term::Clui doesn't yet work 15under Windows. 16 17To install just: 18 perl Makefile.PL ; make ; make install 19 20For up-to-date source, see http://search.cpan.org/~pjb 21 22 23&edit and &view use the default EDITOR and PAGER from the user's 24environment, except that if &view is called with a very short text 25a builtin viewer is used, allowing the user to choose whether the 26text remains on-screen or is cleared. 27 28&confirm expects Y,y,N or n. &ask respects left and right arrows 29and backspace, ctrl-B moves to the beginning, ctrl-E to the end, 30and ctrl-D or ctrl-X clear the current string. 31 32&choose maintains a DBM database of what the user chose last time in 33response to the same question, and if it's still in the list this 34time then &choose highlights it as the default. Thus &choose manages 35its own defaults, and menus using Term::Clui autoconfigure themselves 36to the user's preferences. When &choose is called in an array context, 37it offers the user a multiple choice; mouse-button3 or the Spacebar 38mark items in a multiple choice. If the choices won't fit on the 39screen the user is asked for a substring clue. 40 41The programmer can pass &ask a default string, as an optional second 42argument. &select_file obeys options modelled after those of 43Tk::FileDialog.pm and Tk::SimpleFileSelect.pm 44 45Term::Clui is fast, very easy for both programmer and user, and has 46few external dependencies. It doesn't use curses which is a whole-of 47-screen interface; it uses a portable subset of vt100 sequences (up 48left right normal reverse clrtoeol and mouse-reporting). It handles 49window size changes, using Term::ReadKey or Term::Size if available; 50if not, it tries `tput`. 51 52For the user, Version 1.50 introduced a significant upgrade: mouse- 53-handling. The user can now select an item in &choose using the mouse 54and left-click, as well as by using the arrowkeys and return as before 55(or q or ctrl-X to quit); button3 or the spacebar mark items in a 56multiple choice. Since version 1.62, mouse-handling can be disabled 57by setting CLUI_MOUSE=OFF; by default, it is on. 58 59Since version 1.60, a speaking interface is provided for the visually 60impaired user. It employs either eflite or espeak. Speech is turned 61on if the CLUI_SPEAK environment variable is set to a non-empty string; 62by default, it is off. If speakup is running, then it is silenced 63while Term::Clui runs, and then restored. Because Term::Clui's 64metaphor for the computer is a human-like conversation-partner, this 65works very naturally, and the application needs no modification. 66 67A calling-interface-compatible Python3-module is included. 68 69Peter Billam http://www.pjb.com.au/comp/contact.html 70