Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v9 / man / man3 / Term::ReadLine.3
.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. | will give a
.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
.\" expand to `' in nroff, nothing in troff, for use with C<>.
.tr \(*W-|\(bv\*(Tr
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
'br\}
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.\"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "Term::ReadLine 3"
.TH Term::ReadLine 3 "2001-09-21" "perl v5.8.8" "Perl Programmers Reference Guide"
.SH "NAME"
Term::ReadLine \- Perl interface to various \f(CW\*(C`readline\*(C'\fR packages.
If no real package is found, substitutes stubs instead of basic functions.
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 10
\& use Term::ReadLine;
\& my $term = new Term::ReadLine 'Simple Perl calc';
\& my $prompt = "Enter your arithmetic expression: ";
\& my $OUT = $term->OUT || \e*STDOUT;
\& while ( defined ($_ = $term->readline($prompt)) ) {
\& my $res = eval($_);
\& warn $@ if $@;
\& print $OUT $res, "\en" unless $@;
\& $term->addhistory($_) if /\eS/;
\& }
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This 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
\&\s-1CPAN\s0 (under the \f(CW\*(C`Term::ReadLine::*\*(C'\fR namespace).
.SH "Minimal set of supported functions"
.IX Header "Minimal set of supported functions"
All the supported functions should be called as methods, i.e., either as
.PP
.Vb 1
\& $term = new Term::ReadLine 'name';
.Ve
.PP
or as
.PP
.Vb 1
\& $term->addhistory('row');
.Ve
.PP
where \f(CW$term\fR is a return value of Term::ReadLine\->\fInew()\fR.
.ie n .IP """ReadLine""" 12
.el .IP "\f(CWReadLine\fR" 12
.IX Item "ReadLine"
returns the actual package that executes the commands. Among possible
values are \f(CW\*(C`Term::ReadLine::Gnu\*(C'\fR, \f(CW\*(C`Term::ReadLine::Perl\*(C'\fR,
\&\f(CW\*(C`Term::ReadLine::Stub\*(C'\fR.
.ie n .IP """new""" 12
.el .IP "\f(CWnew\fR" 12
.IX Item "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 \f(CW\*(C`IN\*(C'\fR and \f(CW\*(C`OUT\*(C'\fR filehandles. These
arguments should be globs.
.ie n .IP """readline""" 12
.el .IP "\f(CWreadline\fR" 12
.IX Item "readline"
gets an input line, \fIpossibly\fR with actual \f(CW\*(C`readline\*(C'\fR
support. Trailing newline is removed. Returns \f(CW\*(C`undef\*(C'\fR on \f(CW\*(C`EOF\*(C'\fR.
.ie n .IP """addhistory""" 12
.el .IP "\f(CWaddhistory\fR" 12
.IX Item "addhistory"
adds the line to the history of input, from where it can be used if
the actual \f(CW\*(C`readline\*(C'\fR is present.
.ie n .IP """IN""\fR, \f(CW""OUT""" 12
.el .IP "\f(CWIN\fR, \f(CWOUT\fR" 12
.IX Item "IN, OUT"
return the filehandles for input and output or \f(CW\*(C`undef\*(C'\fR if \f(CW\*(C`readline\*(C'\fR
input and output cannot be used for Perl.
.ie n .IP """MinLine""" 12
.el .IP "\f(CWMinLine\fR" 12
.IX Item "MinLine"
If argument is specified, it is an advice on minimal size of line to
be included into history. \f(CW\*(C`undef\*(C'\fR means do not include anything into
history. Returns the old value.
.ie n .IP """findConsole""" 12
.el .IP "\f(CWfindConsole\fR" 12
.IX Item "findConsole"
returns an array with two strings that give most appropriate names for
files for input and output using conventions \f(CW"<$in"\fR, \f(CW">out"\fR.
.IP "Attribs" 12
.IX Item "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 \f(CW\*(C`rl_\*(C'\fR stripped.
.ie n .IP """Features""" 12
.el .IP "\f(CWFeatures\fR" 12
.IX Item "Features"
Returns a reference to a hash with keys being features present in
current implementation. Several optional features are used in the
minimal interface: \f(CW\*(C`appname\*(C'\fR should be present if the first argument
to \f(CW\*(C`new\*(C'\fR is recognized, and \f(CW\*(C`minline\*(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
lines are put into history automatically (maybe subject to
\&\f(CW\*(C`MinLine\*(C'\fR), and \f(CW\*(C`addhistory\*(C'\fR if \f(CW\*(C`addhistory\*(C'\fR method is not dummy.
.Sp
If \f(CW\*(C`Features\*(C'\fR method reports a feature \f(CW\*(C`attribs\*(C'\fR as present, the
method \f(CW\*(C`Attribs\*(C'\fR is not dummy.
.SH "Additional supported functions"
.IX Header "Additional supported functions"
Actually \f(CW\*(C`Term::ReadLine\*(C'\fR can use some other package, that will
support a richer set of commands.
.PP
All these commands are callable via method interface and have names
which conform to standard conventions with the leading \f(CW\*(C`rl_\*(C'\fR stripped.
.PP
The stub package included with the perl distribution allows some
additional methods:
.ie n .IP """tkRunning""" 12
.el .IP "\f(CWtkRunning\fR" 12
.IX Item "tkRunning"
makes Tk event loop run when waiting for user input (i.e., during
\&\f(CW\*(C`readline\*(C'\fR method).
.ie n .IP """ornaments""" 12
.el .IP "\f(CWornaments\fR" 12
.IX Item "ornaments"
makes the command line stand out by using termcap data. The argument
to \f(CW\*(C`ornaments\*(C'\fR should be 0, 1, or a string of a form
\&\f(CW"aa,bb,cc,dd"\fR. Four components of this string should be names of
\&\fIterminal capacities\fR, first two will be issued to make the prompt
standout, last two to make the input line standout.
.ie n .IP """newTTY""" 12
.el .IP "\f(CWnewTTY\fR" 12
.IX Item "newTTY"
takes two arguments which are input filehandle and output filehandle.
Switches to use these filehandles.
.PP
One can check whether the currently loaded ReadLine package supports
these methods by checking for corresponding \f(CW\*(C`Features\*(C'\fR.
.SH "EXPORTS"
.IX Header "EXPORTS"
None
.SH "ENVIRONMENT"
.IX Header "ENVIRONMENT"
The environment variable \f(CW\*(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
\&\f(CW\*(C`Perl\*(C'\fR or \f(CW\*(C`Gnu\*(C'\fR.
.PP
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 \f(CW\*(C`o=0\*(C'\fR or \f(CW\*(C`ornaments=0\*(C'\fR. The head should be as described above, say
.PP
If the variable is not set, or if the head of space-separated list is
empty, the best available package is loaded.
.PP
.Vb 2
\& export "PERL_RL=Perl o=0" # Use Perl ReadLine without ornaments
\& export "PERL_RL= o=0" # Use best available ReadLine without ornaments
.Ve
.PP
(Note that processing of \f(CW\*(C`PERL_RL\*(C'\fR for ornaments is in the discretion of the
particular used \f(CW\*(C`Term::ReadLine::*\*(C'\fR package).
.SH "CAVEATS"
.IX Header "CAVEATS"
It seems that using Term::ReadLine from Emacs minibuffer doesn't work
quite right and one will get an error message like
.PP
.Vb 1
\& Cannot open /dev/tty for read at ...
.Ve
.PP
One possible workaround for this is to explicitly open /dev/tty like this
.PP
.Vb 4
\& open (FH, "/dev/tty" )
\& or eval 'sub Term::ReadLine::findConsole { ("&STDIN", "&STDERR") }';
\& die $@ if $@;
\& close (FH);
.Ve
.PP
or you can try using the 4\-argument form of Term::ReadLine\->\fInew()\fR.