Linux cli command Term_ReadLine_Gnupm

➡ A Linux man page (short for manual page) is a form of software documentation found on Linux and Unix-like operating systems. This man-page explains the command Term_ReadLine_Gnupm and provides detailed information about the command Term_ReadLine_Gnupm, system calls, library functions, and other aspects of the system, including usage, options, and examples of _. You can access this man page by typing man followed by the Term_ReadLine_Gnupm.

NAME 🖥️ Term_ReadLine_Gnupm 🖥️

Perl extension for the GNU Readline/History Library

SYNOPSIS

use Term::ReadLine; # Do not “use Term::ReadLine::Gnu;” $term = new Term::ReadLine ProgramName; while ( defined ($_ = $term->readline(prompt>)) ) { … }

DESCRIPTION

Overview

This is an implementation of Term::ReadLine <http://search.cpan.org/dist/Term-ReadLine/> using the GNU Readline/History Library <https://tiswww.cwru.edu/php/chet/readline/rltop.html>.

For basic functions object oriented interface is provided. These are described in the section “Standard Methods” and “Term::ReadLine::Gnu Functions”.

This package also has the interface with the almost all functions and variables which are documented in the GNU Readline/History Library Manual. They are documented in the section “Term::ReadLine::Gnu Functions” and “Term::ReadLine::Gnu Variables” briefly. For further details of the GNU Readline/History Library, see GNU Readline Library Manual <https://tiswww.cwru.edu/php/chet/readline/readline.html> and GNU History Library Manual <https://tiswww.cwru.edu/php/chet/readline/history.html>.

There are some Term::ReadLine::Gnu original features. They are described in the section “Term::ReadLine::Gnu Specific Features”

The sample programs under eg/ directory and test programs under t/ directory in the Term::ReadLine::Gnu distribution <http://search.cpan.org/dist/Term-ReadLine-Gnu/> include many examples of this module.

Standard Methods

These are standard methods defined by Term::ReadLine <http://search.cpan.org/dist/Term-ReadLine/>.

“ReadLine”
returns the actual package that executes the commands. If this package is being used, Term::ReadLine::Gnu is returned.

“new(NAME,[IN,OUT])”
returns the handle for subsequent calls to following functions. Argument is the name of the application. Optionally can be followed by two arguments for IN and OUT file handles. These arguments should be globs.

“readline(PROMPT[,PREPUT])”
gets an input line, with actual GNU Readline support. Trailing newline is removed. Returns undef on EOF. PREPUT is an optional argument meaning the initial value of input. The optional argument PREPUT is granted only if the value preput is in Features. PROMPT may include some escape sequences. Use RL_PROMPT_START_IGNORE to begin a sequence of non-printing characters, and RL_PROMPT_END_IGNORE to end the sequence.

“AddHistory(LINE1, LINE2, …)”
adds the lines to the history of input, from where it can be used if the actual readline is present.

“IN”, “OUT”
return the file handles for input and output or undef if readline input and output cannot be used for Perl.

MinLine([MAX])
If argument MAX is specified, it is an advice on minimal size of line to be included into history. undef means do not include anything into history. Returns the old value.

“findConsole”
returns an array with two strings that give most appropriate names for files for input and output using conventions "<$in", ">$out".

“Attribs”
returns a reference to a hash which describes internal configuration (variables) of the package. Names of keys in this hash conform to standard conventions with the leading rl_ stripped. See section “Term::ReadLine::Gnu Variables” for supported variables.

“Features”
Returns a reference to a hash with keys being features present in current implementation. Several optional features are used in the minimal interface: appname should be present if the first argument to new is recognized, and minline should be present if MinLine method is not dummy. autohistory should be present if lines are put into history automatically (maybe subject to MinLine), and addHistory if AddHistory method is not dummy. preput means the second argument to readline method is processed. getHistory and setHistory denote that the corresponding methods are present. tkRunning denotes that a Tk application may run while ReadLine is getting input.

“tkRunning”
makes Tk event loop run when waiting for user input (i.e., during readline method).

“event_loop”
See the description of event_loop on Term::ReadLine <http://search.cpan.org/dist/Term-ReadLine/>.

“ornaments”
makes the command line stand out by using termcap data. The argument to ornaments should be 0, 1, or a string of a form "aa,bb,cc,dd". Four components of this string should be names of terminal capacities, first two will be issued to make the prompt standout, last two to make the input line standout.

“newTTY”
takes two arguments which are input filehandle and output filehandle. Switches to use these filehandles.

“enableUTF8”
Enables UTF-8 support. If STDIN is in UTF-8 by the -C command-line switch or PERL_UNICODE environment variable, or IN file handle has utf8 IO layer, then UTF-8 support is also enabled. In other cases you need this enableUTF8 method. This is an original method of Term::ReadLine:Gnu.

“Term::ReadLine::Gnu” Functions

All these GNU Readline/History Library functions supported are callable via method interface and have names which conform to standard conventions with the leading rl_ stripped. For example rl_foo() function is called as $term->foo().

The titles of the following sections are same as the titles of the corresponding sections in the “Programming with GNU Readline” section in the GNU Readline Library Manual <https://tiswww.cwru.edu/php/chet/readline/readline.html>. Refer them for further details.

Although it is preferred to use method interface, most methods have lower level functions in Term::ReadLine::Gnu::XS package. To use them a full qualified name is required.

Basic Behavior

The function readline() prints a prompt and then reads and returns a single line of text from the user.

$_ = $term->readline(Enter a line: );

You can change key-bindings using bind_key(KEY, FUNCTION [,MAP]) function. The first argument, KEY, is the character that you want bind. The second argument, FUNCTION, is the function to call when KEY is pressed. The FUNCTION can be a reference to a Perl function (see “Custom Functions”) or a “named function” named by add_defun() function or commands described in the “Bindable Readline Commands” section in the GNU Readline Library Manual <https://tiswww.cwru.edu/php/chet/readline/readline.html>.

$term->bind_key(ord "