home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 May / Chip_2000-05_cd1.bin / zkuste / Perl / ActivePerl-5.6.0.613.msi / 䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥 / _a44d5093a9e46e6b8e6766180326a6b5 < prev    next >
Text File  |  2000-03-23  |  9KB  |  196 lines

  1.  
  2. <HTML>
  3. <HEAD>
  4. <TITLE>Term::ReadLine - Perl interface to various C<readline> packages. If
  5. no real package is found, substitutes stubs instead of basic functions.</TITLE>
  6. <LINK REL="stylesheet" HREF="../../Active.css" TYPE="text/css">
  7. <LINK REV="made" HREF="mailto:">
  8. </HEAD>
  9.  
  10. <BODY>
  11. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  12. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  13. <STRONG><P CLASS=block> Term::ReadLine - Perl interface to various C<readline> packages. If
  14. no real package is found, substitutes stubs instead of basic functions.</P></STRONG>
  15. </TD></TR>
  16. </TABLE>
  17.  
  18. <A NAME="__index__"></A>
  19. <!-- INDEX BEGIN -->
  20.  
  21. <UL>
  22.  
  23.     <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
  24.  
  25.     <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
  26.     <LI><A HREF="#description">DESCRIPTION</A></LI>
  27.     <LI><A HREF="#minimal set of supported functions">Minimal set of supported functions</A></LI>
  28.     <LI><A HREF="#additional supported functions">Additional supported functions</A></LI>
  29.     <LI><A HREF="#exports">EXPORTS</A></LI>
  30.     <LI><A HREF="#environment">ENVIRONMENT</A></LI>
  31. </UL>
  32. <!-- INDEX END -->
  33.  
  34. <HR>
  35. <P>
  36. <H1><A NAME="name">NAME</A></H1>
  37. <P>Term::ReadLine - Perl interface to various <A HREF="#item_readline"><CODE>readline</CODE></A> packages. If
  38. no real package is found, substitutes stubs instead of basic functions.</P>
  39. <P>
  40. <HR>
  41. <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
  42. <UL>
  43. <LI>Linux</LI>
  44. <LI>Solaris</LI>
  45. <LI>Windows</LI>
  46. </UL>
  47. <HR>
  48. <H1><A NAME="synopsis">SYNOPSIS</A></H1>
  49. <PRE>
  50.   use Term::ReadLine;
  51.   $term = new Term::ReadLine 'Simple Perl calc';
  52.   $prompt = "Enter your arithmetic expression: ";
  53.   $OUT = $term->OUT || STDOUT;
  54.   while ( defined ($_ = $term->readline($prompt)) ) {
  55.     $res = eval($_), "\n";
  56.     warn $@ if $@;
  57.     print $OUT $res, "\n" unless $@;
  58.     $term->addhistory($_) if /\S/;
  59.   }</PRE>
  60. <P>
  61. <HR>
  62. <H1><A NAME="description">DESCRIPTION</A></H1>
  63. <P>This package is just a front end to some other packages. At the moment
  64. this description is written, the only such package is Term-ReadLine,
  65. available on CPAN near you. The real target of this stub package is to
  66. set up a common interface to whatever Readline emerges with time.</P>
  67. <P>
  68. <HR>
  69. <H1><A NAME="minimal set of supported functions">Minimal set of supported functions</A></H1>
  70. <P>All the supported functions should be called as methods, i.e., either as</P>
  71. <PRE>
  72.   $term = new Term::ReadLine 'name';</PRE>
  73. <P>or as</P>
  74. <PRE>
  75.   $term->addhistory('row');</PRE>
  76. <P>where $term is a return value of Term::ReadLine->Init.</P>
  77. <DL>
  78. <DT><STRONG><A NAME="item_ReadLine"><CODE>ReadLine</CODE></A></STRONG><BR>
  79. <DD>
  80. returns the actual package that executes the commands. Among possible
  81. values are <CODE>Term::ReadLine::Gnu</CODE>, <CODE>Term::ReadLine::Perl</CODE>,
  82. <CODE>Term::ReadLine::Stub Exporter</CODE>.
  83. <P></P>
  84. <DT><STRONG><A NAME="item_new"><CODE>new</CODE></A></STRONG><BR>
  85. <DD>
  86. returns the handle for subsequent calls to following
  87. functions. Argument is the name of the application. Optionally can be
  88. followed by two arguments for <CODE>IN</CODE> and <CODE>OUT</CODE> filehandles. These
  89. arguments should be globs.
  90. <P></P>
  91. <DT><STRONG><A NAME="item_readline"><CODE>readline</CODE></A></STRONG><BR>
  92. <DD>
  93. gets an input line, <EM>possibly</EM> with actual <A HREF="#item_readline"><CODE>readline</CODE></A>
  94. support. Trailing newline is removed. Returns <A HREF="../../lib/Pod/perlfunc.html#item_undef"><CODE>undef</CODE></A> on <CODE>EOF</CODE>.
  95. <P></P>
  96. <DT><STRONG><A NAME="item_addhistory"><CODE>addhistory</CODE></A></STRONG><BR>
  97. <DD>
  98. adds the line to the history of input, from where it can be used if
  99. the actual <A HREF="#item_readline"><CODE>readline</CODE></A> is present.
  100. <P></P>
  101. <DT><STRONG><A NAME="item_IN%2C_%24OUT"><CODE>IN</CODE>, $<CODE>OUT</CODE></A></STRONG><BR>
  102. <DD>
  103. return the filehandles for input and output or <A HREF="../../lib/Pod/perlfunc.html#item_undef"><CODE>undef</CODE></A> if <A HREF="#item_readline"><CODE>readline</CODE></A>
  104. input and output cannot be used for Perl.
  105. <P></P>
  106. <DT><STRONG><A NAME="item_MinLine"><CODE>MinLine</CODE></A></STRONG><BR>
  107. <DD>
  108. If argument is specified, it is an advice on minimal size of line to
  109. be included into history.  <A HREF="../../lib/Pod/perlfunc.html#item_undef"><CODE>undef</CODE></A> means do not include anything into
  110. history. Returns the old value.
  111. <P></P>
  112. <DT><STRONG><A NAME="item_findConsole"><CODE>findConsole</CODE></A></STRONG><BR>
  113. <DD>
  114. returns an array with two strings that give most appropriate names for
  115. files for input and output using conventions <CODE>"<$in"</CODE>, <CODE>">out"</CODE>.
  116. <P></P>
  117. <DT><STRONG><A NAME="item_Attribs">Attribs</A></STRONG><BR>
  118. <DD>
  119. returns a reference to a hash which describes internal configuration
  120. of the package. Names of keys in this hash conform to standard
  121. conventions with the leading <CODE>rl_</CODE> stripped.
  122. <P></P>
  123. <DT><STRONG><A NAME="item_Features"><CODE>Features</CODE></A></STRONG><BR>
  124. <DD>
  125. Returns a reference to a hash with keys being features present in
  126. current implementation. Several optional features are used in the
  127. minimal interface: <CODE>appname</CODE> should be present if the first argument
  128. to <A HREF="#item_new"><CODE>new</CODE></A> is recognized, and <CODE>minline</CODE> should be present if
  129. <A HREF="#item_MinLine"><CODE>MinLine</CODE></A> method is not dummy.  <CODE>autohistory</CODE> should be present if
  130. lines are put into history automatically (maybe subject to
  131. <A HREF="#item_MinLine"><CODE>MinLine</CODE></A>), and <A HREF="#item_addhistory"><CODE>addhistory</CODE></A> if <A HREF="#item_addhistory"><CODE>addhistory</CODE></A> method is not dummy.
  132. <P>If <A HREF="#item_Features"><CODE>Features</CODE></A> method reports a feature <CODE>attribs</CODE> as present, the
  133. method <A HREF="#item_Attribs"><CODE>Attribs</CODE></A> is not dummy.</P>
  134. <P></P></DL>
  135. <P>
  136. <HR>
  137. <H1><A NAME="additional supported functions">Additional supported functions</A></H1>
  138. <P>Actually <CODE>Term::ReadLine</CODE> can use some other package, that will
  139. support reacher set of commands.</P>
  140. <P>All these commands are callable via method interface and have names
  141. which conform to standard conventions with the leading <CODE>rl_</CODE> stripped.</P>
  142. <P>The stub package included with the perl distribution allows some
  143. additional methods:</P>
  144. <DL>
  145. <DT><STRONG><A NAME="item_tkRunning"><CODE>tkRunning</CODE></A></STRONG><BR>
  146. <DD>
  147. makes Tk event loop run when waiting for user input (i.e., during
  148. <A HREF="#item_readline"><CODE>readline</CODE></A> method).
  149. <P></P>
  150. <DT><STRONG><A NAME="item_ornaments"><CODE>ornaments</CODE></A></STRONG><BR>
  151. <DD>
  152. makes the command line stand out by using termcap data.  The argument
  153. to <A HREF="#item_ornaments"><CODE>ornaments</CODE></A> should be 0, 1, or a string of a form
  154. <CODE>"aa,bb,cc,dd"</CODE>.  Four components of this string should be names of
  155. <EM>terminal capacities</EM>, first two will be issued to make the prompt
  156. standout, last two to make the input line standout.
  157. <P></P>
  158. <DT><STRONG><A NAME="item_newTTY"><CODE>newTTY</CODE></A></STRONG><BR>
  159. <DD>
  160. takes two arguments which are input filehandle and output filehandle.
  161. Switches to use these filehandles.
  162. <P></P></DL>
  163. <P>One can check whether the currently loaded ReadLine package supports
  164. these methods by checking for corresponding <A HREF="#item_Features"><CODE>Features</CODE></A>.</P>
  165. <P>
  166. <HR>
  167. <H1><A NAME="exports">EXPORTS</A></H1>
  168. <P>None</P>
  169. <P>
  170. <HR>
  171. <H1><A NAME="environment">ENVIRONMENT</A></H1>
  172. <P>The environment variable <CODE>PERL_RL</CODE> governs which ReadLine clone is
  173. loaded. If the value is false, a dummy interface is used. If the value
  174. is true, it should be tail of the name of the package to use, such as
  175. <CODE>Perl</CODE> or <CODE>Gnu</CODE>.</P>
  176. <P>As a special case, if the value of this variable is space-separated,
  177. the tail might be used to disable the ornaments by setting the tail to
  178. be <CODE>o=0</CODE> or <CODE>ornaments=0</CODE>.  The head should be as described above, say</P>
  179. <P>If the variable is not set, or if the head of space-separated list is
  180. empty, the best available package is loaded.</P>
  181. <PRE>
  182.   export "PERL_RL=Perl o=0"     # Use Perl ReadLine without ornaments
  183.   export "PERL_RL= o=0"         # Use best available ReadLine without ornaments</PRE>
  184. <P>(Note that processing of <CODE>PERL_RL</CODE> for ornaments is in the discretion of the 
  185. particular used <CODE>Term::ReadLine::*</CODE> package).</P>
  186. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  187. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  188. <STRONG><P CLASS=block> Term::ReadLine - Perl interface to various C<readline> packages. If
  189. no real package is found, substitutes stubs instead of basic functions.</P></STRONG>
  190. </TD></TR>
  191. </TABLE>
  192.  
  193. </BODY>
  194.  
  195. </HTML>
  196.