™.. Term::ReadLine - Online Linux Manual PageSection : 3pm
Updated : 2009-07-03
Source : perl v5.10.1
Note : Perl Programmers Reference Guide
NAMETerm::ReadLine − Perl interface to various \*(C`readline\*(C'\fR packages. If no real package is found, substitutes stubs instead of basic functions.
SYNOPSIS use Term::ReadLine;
my $term = Term::ReadLine−>new('Simple Perl calc');
my $prompt = "Enter your arithmetic expression: ";
my $OUT = $term−>OUT || \*STDOUT;
while ( defined ($_ = $term−>readline($prompt)) ) {
my $res = eval($_);
warn $@ if $@;
print $OUT $res, "\n" unless $@;
$term−>addhistory($_) if /\S/;
}
DESCRIPTIONThis package is just a front end to some other packages. It's a stub to set up a common interface to the various ReadLine implementations found on CPAN (under the \*(C`Term::ReadLine::*\*(C'\fR namespace).
Minimal set of supported functionsAll the supported functions should be called as methods, i.e., either as $term = Term::ReadLine−>new('name');
or as $term−>addhistory('row');
where $term is a return value of Term::ReadLine−>new(). ReadLine returns the actual package that executes the commands. Among possible values are \*(C`Term::ReadLine::Gnu\*(C'\fR, \f(CW\*(C`Term::ReadLine::Perl\*(C'\fR, \*(C`Term::ReadLine::Stub\*(C'\fR. new returns the handle for subsequent calls to following functions. Argument is the name of the application. Optionally can be followed by two arguments for \*(C`IN\*(C'\fR and \f(CW\*(C`OUT\*(C'\fR filehandles. These arguments should be globs. readline gets an input line, possibly with actual \*(C`readline\*(C'\fR support. Trailing newline is removed. Returns \*(C`undef\*(C'\fR on \f(CW\*(C`EOF\*(C'\fR. addhistory adds the line to the history of input, from where it can be used if the actual \*(C`readline\*(C'\fR is present. IN, OUT return the filehandles for input and output or \*(C`undef\*(C'\fR if \f(CW\*(C`readline\*(C'\fR input and output cannot be used for Perl. MinLine If argument is specified, it is an advice on minimal size of line to be included into history. \*(C`undef\*(C'\fR 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 of the package. Names of keys in this hash conform to standard conventions with the leading \*(C`rl_\*(C'\fR stripped. Features Returns a reference to a hash with keys being features present in current implementation. Several optional features are used in the minimal interface: \*(C`appname\*(C'\fR should be present if the first argument to \*(C`new\*(C'\fR is recognized, and \f(CW\*(C`minline\*(C'\fR should be present if \*(C`MinLine\*(C'\fR method is not dummy. \f(CW\*(C`autohistory\*(C'\fR should be present if lines are put into history automatically (maybe subject to \*(C`MinLine\*(C'\fR), and \f(CW\*(C`addhistory\*(C'\fR if \f(CW\*(C`addhistory\*(C'\fR method is not dummy. If \*(C`Features\*(C'\fR method reports a feature \f(CW\*(C`attribs\*(C'\fR as present, the method \*(C`Attribs\*(C'\fR is not dummy.
Additional supported functionsActually \*(C`Term::ReadLine\*(C'\fR can use some other package, that will support a richer set of commands. All these commands are callable via method interface and have names which conform to standard conventions with the leading \*(C`rl_\*(C'\fR stripped. The stub package included with the perl distribution allows some additional methods: tkRunning makes Tk event loop run when waiting for user input (i.e., during \*(C`readline\*(C'\fR method). ornaments makes the command line stand out by using termcap data. The argument to \*(C`ornaments\*(C'\fR 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. One can check whether the currently loaded ReadLine package supports these methods by checking for corresponding \*(C`Features\*(C'\fR.
EXPORTSNone
ENVIRONMENTThe environment variable \*(C`PERL_RL\*(C'\fR governs which ReadLine clone is loaded. If the value is false, a dummy interface is used. If the value is true, it should be tail of the name of the package to use, such as \*(C`Perl\*(C'\fR or \f(CW\*(C`Gnu\*(C'\fR. As a special case, if the value of this variable is space-separated, the tail might be used to disable the ornaments by setting the tail to be \*(C`o=0\*(C'\fR or \f(CW\*(C`ornaments=0\*(C'\fR. The head should be as described above, say If the variable is not set, or if the head of space-separated list is empty, the best available package is loaded. export "PERL_RL=Perl o=0" # Use Perl ReadLine without ornaments
export "PERL_RL= o=0" # Use best available ReadLine without ornaments
(Note that processing of \*(C`PERL_RL\*(C'\fR for ornaments is in the discretion of the particular used \*(C`Term::ReadLine::*\*(C'\fR package).
CAVEATSIt seems that using Term::ReadLine from Emacs minibuffer doesn't work quite right and one will get an error message like Cannot open /dev/tty for read at ...
One possible workaround for this is to explicitly open /dev/tty like this open (FH, "/dev/tty" )
or eval 'sub Term::ReadLine::findConsole { ("&STDIN", "&STDERR") }';
die $@ if $@;
close (FH);
or you can try using the 4−argument form of Term::ReadLine−>new(). 0
Johanes Gumabo
Data Size : 21,663 byte
man-Term::ReadLine.3pmBuild : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 2 / 169,046
Visitor ID : :
Visitor IP : 18.191.218.234 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.
ERROR : Need New Coding : (parse_manual_page_|249|Term::ReadLine.3pm|36/37|el══─{─══.|.el══─{─══. ds -- \|\(em\|
) (htmlprn|149|Term::ReadLine.3pm|36/37|.el══─{─══. ds -- — |.el══─{─══. ds -- \|\(em\|
) (parse_manual_page_|249|Term::ReadLine.3pm|41|br══─}─══|'br══─}─══
) (htmlprn|149|Term::ReadLine.3pm|41|'br══─}─══ |'br══─}─══
) (rof_nr_x|149|Term::ReadLine.3pm|51/52|\nF|.ie \nF ══─{─══. de IX
) (rof_unit_scale_px|41|Term::ReadLine.3pm|51/52|F|.ie \nF ══─{─══. de IX
) (rof_if|19|Term::ReadLine.3pm|51/52|\nF|.ie \nF ══─{─══. de IX
) (htmlprn|149|Term::ReadLine.3pm|51/52|.ie \nF ══─{─══. de IX|.ie \nF ══─{─══. de IX
) (rof_escape_sequence|91|Term::ReadLine.3pm|53|\$1\t\\n%\t"\\$2" |. tm Index:\\$1\t\\n%\t"\\$2"
) (parse_manual_page_|249|Term::ReadLine.3pm|57|══─}─══|.══─}─══
) (htmlprn|149|Term::ReadLine.3pm|57|.══─}─══ |.══─}─══
) (rof_escape_sequence|91|Term::ReadLine.3pm|133|\*(C`readline\*(C'\fR packages. |Term::ReadLine \- Perl interface to various \f(CW\*(C`readline\*(C'\fR packages.
) (rof_escape_sequence|91|Term::ReadLine.3pm|153|\*(C`Term::ReadLine::*\*(C'\fR namespace). |\&\s-1CPAN\s0 (under the \f(CW\*(C`Term::ReadLine::*\*(C'\fR namespace).
) (rof_escape_sequence|91|Term::ReadLine.3pm|173|\*(C`Term::ReadLine::Gnu\*(C'\fR, \f(CW\*(C`Term::ReadLine::Perl\*(C'\fR, |values are \f(CW\*(C`Term::ReadLine::Gnu\*(C'\fR, \f(CW\*(C`Term::ReadLine::Perl\*(C'\fR,
) (rof_escape_sequence|91|Term::ReadLine.3pm|174|\*(C`Term::ReadLine::Stub\*(C'\fR. |\&\f(CW\*(C`Term::ReadLine::Stub\*(C'\fR.
) (rof_escape_sequence|91|Term::ReadLine.3pm|180|\*(C`IN\*(C'\fR and \f(CW\*(C`OUT\*(C'\fR filehandles. These |followed by two arguments for \f(CW\*(C`IN\*(C'\fR and \f(CW\*(C`OUT\*(C'\fR filehandles. These
) (rof_escape_sequence|91|Term::ReadLine.3pm|185|\*(C`readline\*(C'\fR |gets an input line, \fIpossibly\fR with actual \f(CW\*(C`readline\*(C'\fR
) (rof_escape_sequence|91|Term::ReadLine.3pm|186|\*(C`undef\*(C'\fR on \f(CW\*(C`EOF\*(C'\fR. |support. Trailing newline is removed. Returns \f(CW\*(C`undef\*(C'\fR on \f(CW\*(C`EOF\*(C'\fR.
) (rof_escape_sequence|91|Term::ReadLine.3pm|191|\*(C`readline\*(C'\fR is present. |the actual \f(CW\*(C`readline\*(C'\fR is present.
) (rof_escape_sequence|91|Term::ReadLine.3pm|195|\*(C`undef\*(C'\fR if \f(CW\*(C`readline\*(C'\fR |return the filehandles for input and output or \f(CW\*(C`undef\*(C'\fR if \f(CW\*(C`readline\*(C'\fR
) (rof_escape_sequence|91|Term::ReadLine.3pm|201|\*(C`undef\*(C'\fR means do not include anything into |be included into history. \f(CW\*(C`undef\*(C'\fR means do not include anything into
) (rof_escape_sequence|91|Term::ReadLine.3pm|212|\*(C`rl_\*(C'\fR stripped. |conventions with the leading \f(CW\*(C`rl_\*(C'\fR stripped.
) (rof_escape_sequence|91|Term::ReadLine.3pm|218|\*(C`appname\*(C'\fR should be present if the first argument |minimal interface: \f(CW\*(C`appname\*(C'\fR should be present if the first argument
) (rof_escape_sequence|91|Term::ReadLine.3pm|219|\*(C`new\*(C'\fR is recognized, and \f(CW\*(C`minline\*(C'\fR should be present if |to \f(CW\*(C`new\*(C'\fR is recognized, and \f(CW\*(C`minline\*(C'\fR should be present if
) (rof_escape_sequence|91|Term::ReadLine.3pm|220|\*(C`MinLine\*(C'\fR method is not dummy. \f(CW\*(C`autohistory\*(C'\fR should be present if |\&\f(CW\*(C`MinLine\*(C'\fR method is not dummy. \f(CW\*(C`autohistory\*(C'\fR should be present if
) (rof_escape_sequence|91|Term::ReadLine.3pm|222|\*(C`MinLine\*(C'\fR), and \f(CW\*(C`addhistory\*(C'\fR if \f(CW\*(C`addhistory\*(C'\fR method is not dummy. |\&\f(CW\*(C`MinLine\*(C'\fR), and \f(CW\*(C`addhistory\*(C'\fR if \f(CW\*(C`addhistory\*(C'\fR method is not dummy.
) (rof_escape_sequence|91|Term::ReadLine.3pm|224|\*(C`Features\*(C'\fR method reports a feature \f(CW\*(C`attribs\*(C'\fR as present, the |If \f(CW\*(C`Features\*(C'\fR method reports a feature \f(CW\*(C`attribs\*(C'\fR as present, the
) (rof_escape_sequence|91|Term::ReadLine.3pm|225|\*(C`Attribs\*(C'\fR is not dummy. |method \f(CW\*(C`Attribs\*(C'\fR is not dummy.
) (rof_escape_sequence|91|Term::ReadLine.3pm|228|\*(C`Term::ReadLine\*(C'\fR can use some other package, that will |Actually \f(CW\*(C`Term::ReadLine\*(C'\fR can use some other package, that will
) (rof_escape_sequence|91|Term::ReadLine.3pm|232|\*(C`rl_\*(C'\fR stripped. |which conform to standard conventions with the leading \f(CW\*(C`rl_\*(C'\fR stripped.
) (rof_escape_sequence|91|Term::ReadLine.3pm|240|\*(C`readline\*(C'\fR method). |\&\f(CW\*(C`readline\*(C'\fR method).
) (rof_escape_sequence|91|Term::ReadLine.3pm|245|\*(C`ornaments\*(C'\fR should be 0, 1, or a string of a form |to \f(CW\*(C`ornaments\*(C'\fR should be 0, 1, or a string of a form
) (rof_escape_sequence|91|Term::ReadLine.3pm|256|\*(C`Features\*(C'\fR. |these methods by checking for corresponding \f(CW\*(C`Features\*(C'\fR.
) (rof_escape_sequence|91|Term::ReadLine.3pm|262|\*(C`PERL_RL\*(C'\fR governs which ReadLine clone is |The environment variable \f(CW\*(C`PERL_RL\*(C'\fR governs which ReadLine clone is
) (rof_escape_sequence|91|Term::ReadLine.3pm|265|\*(C`Perl\*(C'\fR or \f(CW\*(C`Gnu\*(C'\fR. |\&\f(CW\*(C`Perl\*(C'\fR or \f(CW\*(C`Gnu\*(C'\fR.
) (rof_escape_sequence|91|Term::ReadLine.3pm|269|\*(C`o=0\*(C'\fR or \f(CW\*(C`ornaments=0\*(C'\fR. The head should be as described above, say |be \f(CW\*(C`o=0\*(C'\fR or \f(CW\*(C`ornaments=0\*(C'\fR. The head should be as described above, say
) (rof_escape_sequence|91|Term::ReadLine.3pm|279|\*(C`PERL_RL\*(C'\fR for ornaments is in the discretion of the |(Note that processing of \f(CW\*(C`PERL_RL\*(C'\fR for ornaments is in the discretion of the
) (rof_escape_sequence|91|Term::ReadLine.3pm|280|\*(C`Term::ReadLine::*\*(C'\fR package). |particular used \f(CW\*(C`Term::ReadLine::*\*(C'\fR package).
)