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

  1.  
  2. <HTML>
  3. <HEAD>
  4. <TITLE>Term::Cap - Perl termcap interface</TITLE>
  5. <LINK REL="stylesheet" HREF="../../Active.css" TYPE="text/css">
  6. <LINK REV="made" HREF="mailto:">
  7. </HEAD>
  8.  
  9. <BODY>
  10. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  11. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  12. <STRONG><P CLASS=block> Term::Cap - Perl termcap interface</P></STRONG>
  13. </TD></TR>
  14. </TABLE>
  15.  
  16. <A NAME="__index__"></A>
  17. <!-- INDEX BEGIN -->
  18.  
  19. <UL>
  20.  
  21.     <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
  22.  
  23.     <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
  24.     <LI><A HREF="#description">DESCRIPTION</A></LI>
  25.     <LI><A HREF="#examples">EXAMPLES</A></LI>
  26. </UL>
  27. <!-- INDEX END -->
  28.  
  29. <HR>
  30. <P>
  31. <H1><A NAME="name">NAME</A></H1>
  32. <P>Term::Cap - Perl termcap interface</P>
  33. <P>
  34. <HR>
  35. <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
  36. <UL>
  37. <LI>Linux</LI>
  38. <LI>Solaris</LI>
  39. <LI>Windows</LI>
  40. </UL>
  41. <HR>
  42. <H1><A NAME="synopsis">SYNOPSIS</A></H1>
  43. <PRE>
  44.     require Term::Cap;
  45.     $terminal = Tgetent Term::Cap { TERM => undef, OSPEED => $ospeed };
  46.     $terminal->Trequire(qw/ce ku kd/);
  47.     $terminal->Tgoto('cm', $col, $row, $FH);
  48.     $terminal->Tputs('dl', $count, $FH);
  49.     $terminal->Tpad($string, $count, $FH);</PRE>
  50. <P>
  51. <HR>
  52. <H1><A NAME="description">DESCRIPTION</A></H1>
  53. <P>These are low-level functions to extract and use capabilities from
  54. a terminal capability (termcap) database.</P>
  55. <P>The <STRONG>Tgetent</STRONG> function extracts the entry of the specified terminal
  56. type <EM>TERM</EM> (defaults to the environment variable <EM>TERM</EM>) from the
  57. database.</P>
  58. <P>It will look in the environment for a <EM>TERMCAP</EM> variable.  If
  59. found, and the value does not begin with a slash, and the terminal
  60. type name is the same as the environment string <EM>TERM</EM>, the
  61. <EM>TERMCAP</EM> string is used instead of reading a termcap file.  If
  62. it does begin with a slash, the string is used as a path name of
  63. the termcap file to search.  If <EM>TERMCAP</EM> does not begin with a
  64. slash and name is different from <EM>TERM</EM>, <STRONG>Tgetent</STRONG> searches the
  65. files <EM>$HOME/.termcap</EM>, <EM>/etc/termcap</EM>, and <EM>/usr/share/misc/termcap</EM>,
  66. in that order, unless the environment variable <EM>TERMPATH</EM> exists,
  67. in which case it specifies a list of file pathnames (separated by
  68. spaces or colons) to be searched <STRONG>instead</STRONG>.  Whenever multiple
  69. files are searched and a tc field occurs in the requested entry,
  70. the entry it names must be found in the same file or one of the
  71. succeeding files.  If there is a <CODE>:tc=...:</CODE> in the <EM>TERMCAP</EM>
  72. environment variable string it will continue the search in the
  73. files as above.</P>
  74. <P><EM>OSPEED</EM> is the terminal output bit rate (often mistakenly called
  75. the baud rate).  <EM>OSPEED</EM> can be specified as either a POSIX
  76. termios/SYSV termio speeds (where 9600 equals 9600) or an old
  77. BSD-style speeds (where 13 equals 9600).</P>
  78. <P><STRONG>Tgetent</STRONG> returns a blessed object reference which the user can
  79. then use to send the control strings to the terminal using <STRONG>Tputs</STRONG>
  80. and <STRONG>Tgoto</STRONG>.  It calls <CODE>croak</CODE> on failure.</P>
  81. <P><STRONG>Tgoto</STRONG> decodes a cursor addressing string with the given parameters.</P>
  82. <P>The output strings for <STRONG>Tputs</STRONG> are cached for counts of 1 for performance.
  83. <STRONG>Tgoto</STRONG> and <STRONG>Tpad</STRONG> do not cache.  <CODE>$self->{_xx}</CODE> is the raw termcap
  84. data and <CODE>$self->{xx}</CODE> is the cached version.</P>
  85. <PRE>
  86.     print $terminal->Tpad($self->{_xx}, 1);</PRE>
  87. <P><STRONG>Tgoto</STRONG>, <STRONG>Tputs</STRONG>, and <STRONG>Tpad</STRONG> return the string and will also
  88. output the string to $FH if specified.</P>
  89. <P>The extracted termcap entry is available in the object
  90. as <CODE>$self->{TERMCAP}</CODE>.</P>
  91. <P>
  92. <HR>
  93. <H1><A NAME="examples">EXAMPLES</A></H1>
  94. <PRE>
  95.     # Get terminal output speed
  96.     require POSIX;
  97.     my $termios = new POSIX::Termios;
  98.     $termios->getattr;
  99.     my $ospeed = $termios->getospeed;</PRE>
  100. <PRE>
  101.     # Old-style ioctl code to get ospeed:
  102.     #     require 'ioctl.pl';
  103.     #     ioctl(TTY,$TIOCGETP,$sgtty);
  104.     #     ($ispeed,$ospeed) = unpack('cc',$sgtty);</PRE>
  105. <PRE>
  106.     # allocate and initialize a terminal structure
  107.     $terminal = Tgetent Term::Cap { TERM => undef, OSPEED => $ospeed };</PRE>
  108. <PRE>
  109.     # require certain capabilities to be available
  110.     $terminal->Trequire(qw/ce ku kd/);</PRE>
  111. <PRE>
  112.     # Output Routines, if $FH is undefined these just return the string</PRE>
  113. <PRE>
  114.     # Tgoto does the % expansion stuff with the given args
  115.     $terminal->Tgoto('cm', $col, $row, $FH);</PRE>
  116. <PRE>
  117.     # Tputs doesn't do any % expansion.
  118.     $terminal->Tputs('dl', $count = 1, $FH);</PRE>
  119. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  120. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  121. <STRONG><P CLASS=block> Term::Cap - Perl termcap interface</P></STRONG>
  122. </TD></TR>
  123. </TABLE>
  124.  
  125. </BODY>
  126.  
  127. </HTML>
  128.