Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / man / man3 / Term::ReadLine.3
CommitLineData
920dae64
AT
1.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
2.\"
3.\" Standard preamble:
4.\" ========================================================================
5.de Sh \" Subsection heading
6.br
7.if t .Sp
8.ne 5
9.PP
10\fB\\$1\fR
11.PP
12..
13.de Sp \" Vertical space (when we can't use .PP)
14.if t .sp .5v
15.if n .sp
16..
17.de Vb \" Begin verbatim text
18.ft CW
19.nf
20.ne \\$1
21..
22.de Ve \" End verbatim text
23.ft R
24.fi
25..
26.\" Set up some character translations and predefined strings. \*(-- will
27.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28.\" double quote, and \*(R" will give a right double quote. | will give a
29.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
30.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
31.\" expand to `' in nroff, nothing in troff, for use with C<>.
32.tr \(*W-|\(bv\*(Tr
33.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34.ie n \{\
35. ds -- \(*W-
36. ds PI pi
37. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
39. ds L" ""
40. ds R" ""
41. ds C` ""
42. ds C' ""
43'br\}
44.el\{\
45. ds -- \|\(em\|
46. ds PI \(*p
47. ds L" ``
48. ds R" ''
49'br\}
50.\"
51.\" If the F register is turned on, we'll generate index entries on stderr for
52.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53.\" entries marked with X<> in POD. Of course, you'll have to process the
54.\" output yourself in some meaningful fashion.
55.if \nF \{\
56. de IX
57. tm Index:\\$1\t\\n%\t"\\$2"
58..
59. nr % 0
60. rr F
61.\}
62.\"
63.\" For nroff, turn off justification. Always turn off hyphenation; it makes
64.\" way too many mistakes in technical documents.
65.hy 0
66.if n .na
67.\"
68.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69.\" Fear. Run. Save yourself. No user-serviceable parts.
70. \" fudge factors for nroff and troff
71.if n \{\
72. ds #H 0
73. ds #V .8m
74. ds #F .3m
75. ds #[ \f1
76. ds #] \fP
77.\}
78.if t \{\
79. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80. ds #V .6m
81. ds #F 0
82. ds #[ \&
83. ds #] \&
84.\}
85. \" simple accents for nroff and troff
86.if n \{\
87. ds ' \&
88. ds ` \&
89. ds ^ \&
90. ds , \&
91. ds ~ ~
92. ds /
93.\}
94.if t \{\
95. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101.\}
102. \" troff and (daisy-wheel) nroff accents
103.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110.ds ae a\h'-(\w'a'u*4/10)'e
111.ds Ae A\h'-(\w'A'u*4/10)'E
112. \" corrections for vroff
113.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115. \" for low resolution devices (crt and lpr)
116.if \n(.H>23 .if \n(.V>19 \
117\{\
118. ds : e
119. ds 8 ss
120. ds o a
121. ds d- d\h'-1'\(ga
122. ds D- D\h'-1'\(hy
123. ds th \o'bp'
124. ds Th \o'LP'
125. ds ae ae
126. ds Ae AE
127.\}
128.rm #[ #] #H #V #F C
129.\" ========================================================================
130.\"
131.IX Title "Term::ReadLine 3"
132.TH Term::ReadLine 3 "2001-09-21" "perl v5.8.8" "Perl Programmers Reference Guide"
133.SH "NAME"
134Term::ReadLine \- Perl interface to various \f(CW\*(C`readline\*(C'\fR packages.
135If no real package is found, substitutes stubs instead of basic functions.
136.SH "SYNOPSIS"
137.IX Header "SYNOPSIS"
138.Vb 10
139\& use Term::ReadLine;
140\& my $term = new Term::ReadLine 'Simple Perl calc';
141\& my $prompt = "Enter your arithmetic expression: ";
142\& my $OUT = $term->OUT || \e*STDOUT;
143\& while ( defined ($_ = $term->readline($prompt)) ) {
144\& my $res = eval($_);
145\& warn $@ if $@;
146\& print $OUT $res, "\en" unless $@;
147\& $term->addhistory($_) if /\eS/;
148\& }
149.Ve
150.SH "DESCRIPTION"
151.IX Header "DESCRIPTION"
152This package is just a front end to some other packages. It's a stub to
153set up a common interface to the various ReadLine implementations found on
154\&\s-1CPAN\s0 (under the \f(CW\*(C`Term::ReadLine::*\*(C'\fR namespace).
155.SH "Minimal set of supported functions"
156.IX Header "Minimal set of supported functions"
157All the supported functions should be called as methods, i.e., either as
158.PP
159.Vb 1
160\& $term = new Term::ReadLine 'name';
161.Ve
162.PP
163or as
164.PP
165.Vb 1
166\& $term->addhistory('row');
167.Ve
168.PP
169where \f(CW$term\fR is a return value of Term::ReadLine\->\fInew()\fR.
170.ie n .IP """ReadLine""" 12
171.el .IP "\f(CWReadLine\fR" 12
172.IX Item "ReadLine"
173returns the actual package that executes the commands. Among possible
174values are \f(CW\*(C`Term::ReadLine::Gnu\*(C'\fR, \f(CW\*(C`Term::ReadLine::Perl\*(C'\fR,
175\&\f(CW\*(C`Term::ReadLine::Stub\*(C'\fR.
176.ie n .IP """new""" 12
177.el .IP "\f(CWnew\fR" 12
178.IX Item "new"
179returns the handle for subsequent calls to following
180functions. Argument is the name of the application. Optionally can be
181followed by two arguments for \f(CW\*(C`IN\*(C'\fR and \f(CW\*(C`OUT\*(C'\fR filehandles. These
182arguments should be globs.
183.ie n .IP """readline""" 12
184.el .IP "\f(CWreadline\fR" 12
185.IX Item "readline"
186gets an input line, \fIpossibly\fR with actual \f(CW\*(C`readline\*(C'\fR
187support. Trailing newline is removed. Returns \f(CW\*(C`undef\*(C'\fR on \f(CW\*(C`EOF\*(C'\fR.
188.ie n .IP """addhistory""" 12
189.el .IP "\f(CWaddhistory\fR" 12
190.IX Item "addhistory"
191adds the line to the history of input, from where it can be used if
192the actual \f(CW\*(C`readline\*(C'\fR is present.
193.ie n .IP """IN""\fR, \f(CW""OUT""" 12
194.el .IP "\f(CWIN\fR, \f(CWOUT\fR" 12
195.IX Item "IN, OUT"
196return the filehandles for input and output or \f(CW\*(C`undef\*(C'\fR if \f(CW\*(C`readline\*(C'\fR
197input and output cannot be used for Perl.
198.ie n .IP """MinLine""" 12
199.el .IP "\f(CWMinLine\fR" 12
200.IX Item "MinLine"
201If argument is specified, it is an advice on minimal size of line to
202be included into history. \f(CW\*(C`undef\*(C'\fR means do not include anything into
203history. Returns the old value.
204.ie n .IP """findConsole""" 12
205.el .IP "\f(CWfindConsole\fR" 12
206.IX Item "findConsole"
207returns an array with two strings that give most appropriate names for
208files for input and output using conventions \f(CW"<$in"\fR, \f(CW">out"\fR.
209.IP "Attribs" 12
210.IX Item "Attribs"
211returns a reference to a hash which describes internal configuration
212of the package. Names of keys in this hash conform to standard
213conventions with the leading \f(CW\*(C`rl_\*(C'\fR stripped.
214.ie n .IP """Features""" 12
215.el .IP "\f(CWFeatures\fR" 12
216.IX Item "Features"
217Returns a reference to a hash with keys being features present in
218current implementation. Several optional features are used in the
219minimal interface: \f(CW\*(C`appname\*(C'\fR should be present if the first argument
220to \f(CW\*(C`new\*(C'\fR is recognized, and \f(CW\*(C`minline\*(C'\fR should be present if
221\&\f(CW\*(C`MinLine\*(C'\fR method is not dummy. \f(CW\*(C`autohistory\*(C'\fR should be present if
222lines are put into history automatically (maybe subject to
223\&\f(CW\*(C`MinLine\*(C'\fR), and \f(CW\*(C`addhistory\*(C'\fR if \f(CW\*(C`addhistory\*(C'\fR method is not dummy.
224.Sp
225If \f(CW\*(C`Features\*(C'\fR method reports a feature \f(CW\*(C`attribs\*(C'\fR as present, the
226method \f(CW\*(C`Attribs\*(C'\fR is not dummy.
227.SH "Additional supported functions"
228.IX Header "Additional supported functions"
229Actually \f(CW\*(C`Term::ReadLine\*(C'\fR can use some other package, that will
230support a richer set of commands.
231.PP
232All these commands are callable via method interface and have names
233which conform to standard conventions with the leading \f(CW\*(C`rl_\*(C'\fR stripped.
234.PP
235The stub package included with the perl distribution allows some
236additional methods:
237.ie n .IP """tkRunning""" 12
238.el .IP "\f(CWtkRunning\fR" 12
239.IX Item "tkRunning"
240makes Tk event loop run when waiting for user input (i.e., during
241\&\f(CW\*(C`readline\*(C'\fR method).
242.ie n .IP """ornaments""" 12
243.el .IP "\f(CWornaments\fR" 12
244.IX Item "ornaments"
245makes the command line stand out by using termcap data. The argument
246to \f(CW\*(C`ornaments\*(C'\fR should be 0, 1, or a string of a form
247\&\f(CW"aa,bb,cc,dd"\fR. Four components of this string should be names of
248\&\fIterminal capacities\fR, first two will be issued to make the prompt
249standout, last two to make the input line standout.
250.ie n .IP """newTTY""" 12
251.el .IP "\f(CWnewTTY\fR" 12
252.IX Item "newTTY"
253takes two arguments which are input filehandle and output filehandle.
254Switches to use these filehandles.
255.PP
256One can check whether the currently loaded ReadLine package supports
257these methods by checking for corresponding \f(CW\*(C`Features\*(C'\fR.
258.SH "EXPORTS"
259.IX Header "EXPORTS"
260None
261.SH "ENVIRONMENT"
262.IX Header "ENVIRONMENT"
263The environment variable \f(CW\*(C`PERL_RL\*(C'\fR governs which ReadLine clone is
264loaded. If the value is false, a dummy interface is used. If the value
265is true, it should be tail of the name of the package to use, such as
266\&\f(CW\*(C`Perl\*(C'\fR or \f(CW\*(C`Gnu\*(C'\fR.
267.PP
268As a special case, if the value of this variable is space\-separated,
269the tail might be used to disable the ornaments by setting the tail to
270be \f(CW\*(C`o=0\*(C'\fR or \f(CW\*(C`ornaments=0\*(C'\fR. The head should be as described above, say
271.PP
272If the variable is not set, or if the head of space-separated list is
273empty, the best available package is loaded.
274.PP
275.Vb 2
276\& export "PERL_RL=Perl o=0" # Use Perl ReadLine without ornaments
277\& export "PERL_RL= o=0" # Use best available ReadLine without ornaments
278.Ve
279.PP
280(Note that processing of \f(CW\*(C`PERL_RL\*(C'\fR for ornaments is in the discretion of the
281particular used \f(CW\*(C`Term::ReadLine::*\*(C'\fR package).
282.SH "CAVEATS"
283.IX Header "CAVEATS"
284It seems that using Term::ReadLine from Emacs minibuffer doesn't work
285quite right and one will get an error message like
286.PP
287.Vb 1
288\& Cannot open /dev/tty for read at ...
289.Ve
290.PP
291One possible workaround for this is to explicitly open /dev/tty like this
292.PP
293.Vb 4
294\& open (FH, "/dev/tty" )
295\& or eval 'sub Term::ReadLine::findConsole { ("&STDIN", "&STDERR") }';
296\& die $@ if $@;
297\& close (FH);
298.Ve
299.PP
300or you can try using the 4\-argument form of Term::ReadLine\->\fInew()\fR.