📄 term::readline.3
字号:
.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05).\".\" 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. \*(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-.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\}.\".\" Escape single quotes in literal strings from groff's Unicode transform..ie \n(.g .ds Aq \(aq.el .ds Aq '.\".\" 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..ie \nF \{\. de IX. tm Index:\\$1\t\\n%\t"\\$2"... nr % 0. rr F.\}.el \{\. de IX...\}.\".\" 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 "2007-12-18" "perl v5.10.0" "Perl Programmers Reference Guide".\" For nroff, turn off justification. Always turn off hyphenation; it makes.\" way too many mistakes in technical documents..if n .ad l.nh.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 \*(AqSimple Perl calc\*(Aq;\& 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 toset 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 \*(Aqname\*(Aq;.Ve.PPor as.PP.Vb 1\& $term\->addhistory(\*(Aqrow\*(Aq);.Ve.PPwhere \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 possiblevalues 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 followingfunctions. Argument is the name of the application. Optionally can befollowed by two arguments for \f(CW\*(C`IN\*(C'\fR and \f(CW\*(C`OUT\*(C'\fR filehandles. Thesearguments 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'\fRsupport. 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 ifthe 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'\fRinput 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 tobe included into history. \f(CW\*(C`undef\*(C'\fR means do not include anything intohistory. 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 forfiles 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 configurationof the package. Names of keys in this hash conform to standardconventions 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 incurrent implementation. Several optional features are used in theminimal interface: \f(CW\*(C`appname\*(C'\fR should be present if the first argumentto \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 iflines 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..SpIf \f(CW\*(C`Features\*(C'\fR method reports a feature \f(CW\*(C`attribs\*(C'\fR as present, themethod \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 willsupport a richer set of commands..PPAll these commands are callable via method interface and have nameswhich conform to standard conventions with the leading \f(CW\*(C`rl_\*(C'\fR stripped..PPThe stub package included with the perl distribution allows someadditional 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 argumentto \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 promptstandout, 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..PPOne can check whether the currently loaded ReadLine package supportsthese 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 isloaded. If the value is false, a dummy interface is used. If the valueis 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..PPAs 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 tobe \f(CW\*(C`o=0\*(C'\fR or \f(CW\*(C`ornaments=0\*(C'\fR. The head should be as described above, say.PPIf the variable is not set, or if the head of space-separated list isempty, 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 workquite right and one will get an error message like.PP.Vb 1\& Cannot open /dev/tty for read at ....Ve.PPOne possible workaround for this is to explicitly open /dev/tty like this.PP.Vb 4\& open (FH, "/dev/tty" )\& or eval \*(Aqsub Term::ReadLine::findConsole { ("&STDIN", "&STDERR") }\*(Aq;\& die $@ if $@;\& close (FH);.Ve.PPor you can try using the 4\-argument form of Term::ReadLine\->\fInew()\fR.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -