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

  1.  
  2. <HTML>
  3. <HEAD>
  4. <TITLE>main/site/lib/SGMLS/Refs.pm</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> main/site/lib/SGMLS/Refs.pm</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="#author and copyright">AUTHOR AND COPYRIGHT</A></LI>
  26.     <LI><A HREF="#see also:">SEE ALSO:</A></LI>
  27. </UL>
  28. <!-- INDEX END -->
  29.  
  30. <HR>
  31. <P>
  32. <H1><A NAME="name">NAME</A></H1>
  33. <P>SGMLS::Refs</P>
  34. <P>
  35. <HR>
  36. <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
  37. <UL>
  38. <LI>Windows</LI>
  39. </UL>
  40. <HR>
  41. <H1><A NAME="synopsis">SYNOPSIS</A></H1>
  42. <PRE>
  43.   use SGMLS::Refs;</PRE>
  44. <P>To create a new reference-manager object using the file ``foo.refs'':</P>
  45. <PRE>
  46.   my $refs = new SGMLS::Refs("foo.refs");</PRE>
  47. <P>To create a new reference-manager object using the file ``foo.refs'' and
  48. logging changes to the file ``foo.log'':</P>
  49. <PRE>
  50.   my $refs = new SGMLS::Refs("foo.refs","foo.log");</PRE>
  51. <P>To record a reference:</P>
  52. <PRE>
  53.   $refs->put("document title",$title);</PRE>
  54. <P>To retrieve a reference:</P>
  55. <PRE>
  56.   $title = $refs->get("document title");</PRE>
  57. <P>To return the number of references changed since the last run:</P>
  58. <PRE>
  59.   $num = $refs->changed;</PRE>
  60. <P>To print a LaTeX-like warning if any references have changed:</P>
  61. <PRE>
  62.   $refs->warn;</PRE>
  63. <P>
  64. <HR>
  65. <H1><A NAME="description">DESCRIPTION</A></H1>
  66. <P>This library can be used together with the <STRONG>SGMLS</STRONG> package to keep
  67. track of forward references from one run to another, like the <STRONG>LaTeX</STRONG>
  68. <CODE>.aux</CODE> files.  Each reference manager is an object which reads and
  69. then rewrites a file of perl source, with the file name provided by
  70. the caller.</P>
  71. <P>Example:</P>
  72. <PRE>
  73.   # Start up the reference manager before the parse.
  74.   sgml('start', sub { $refs = new SGMLS::Refs("foo.refs"); });</PRE>
  75. <PRE>
  76.   # Warn about any changed references at the end.
  77.   sgml('end', sub { $refs->warn; });</PRE>
  78. <PRE>
  79.   # Look up the title from the last parse, if available.
  80.   sgml('<div>', sub { 
  81.     my $element = shift;
  82.     my $id = $element->attribute(ID)->value;
  83.     my $title = $refs->get("title:$id") || "[no title available]";</PRE>
  84. <PRE>
  85.     $current_div_id = $id;</PRE>
  86. <PRE>
  87.     output "\\section{$title}\n\n";
  88.   });</PRE>
  89. <PRE>
  90.   # Save the title for the next parse.
  91.   sgml('<head>', sub { push_output('string'); });
  92.   sgml('</head>', sub {
  93.     my $title = pop_output();
  94.     my $id = $current_div_id;</PRE>
  95. <PRE>
  96.     $refs->put("title:$id",$title);
  97.   });</PRE>
  98. <P>
  99. <HR>
  100. <H1><A NAME="author and copyright">AUTHOR AND COPYRIGHT</A></H1>
  101. <P>Copyright 1994 and 1995 by David Megginson,
  102. <CODE>dmeggins@aix1.uottawa.ca</CODE>.  Distributed under the terms of the Gnu
  103. General Public License (version 2, 1991) -- see the file <CODE>COPYING</CODE>
  104. which is included in the <STRONG>SGMLS.pm</STRONG> distribution.</P>
  105. <P>
  106. <HR>
  107. <H1><A NAME="see also:">SEE ALSO:</A></H1>
  108. <P><A HREF="../../../site/lib/SGMLS.html">the SGMLS manpage</A>, <A HREF="../../../site/lib/SGMLS/Output.html">the SGMLS::Output manpage</A>.</P>
  109. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  110. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  111. <STRONG><P CLASS=block> main/site/lib/SGMLS/Refs.pm</P></STRONG>
  112. </TD></TR>
  113. </TABLE>
  114.  
  115. </BODY>
  116.  
  117. </HTML>
  118.