home *** CD-ROM | disk | FTP | other *** search
-
- <HTML>
- <HEAD>
- <TITLE>main/site/lib/SGMLS/Refs.pm</TITLE>
- <LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css">
- <LINK REV="made" HREF="mailto:">
- </HEAD>
-
- <BODY>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> main/site/lib/SGMLS/Refs.pm</P></STRONG>
- </TD></TR>
- </TABLE>
-
- <A NAME="__index__"></A>
- <!-- INDEX BEGIN -->
-
- <UL>
-
- <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
-
- <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
- <LI><A HREF="#description">DESCRIPTION</A></LI>
- <LI><A HREF="#author and copyright">AUTHOR AND COPYRIGHT</A></LI>
- <LI><A HREF="#see also:">SEE ALSO:</A></LI>
- </UL>
- <!-- INDEX END -->
-
- <HR>
- <P>
- <H1><A NAME="name">NAME</A></H1>
- <P>SGMLS::Refs</P>
- <P>
- <HR>
- <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
- <UL>
- <LI>Windows</LI>
- </UL>
- <HR>
- <H1><A NAME="synopsis">SYNOPSIS</A></H1>
- <PRE>
- use SGMLS::Refs;</PRE>
- <P>To create a new reference-manager object using the file ``foo.refs'':</P>
- <PRE>
- my $refs = new SGMLS::Refs("foo.refs");</PRE>
- <P>To create a new reference-manager object using the file ``foo.refs'' and
- logging changes to the file ``foo.log'':</P>
- <PRE>
- my $refs = new SGMLS::Refs("foo.refs","foo.log");</PRE>
- <P>To record a reference:</P>
- <PRE>
- $refs->put("document title",$title);</PRE>
- <P>To retrieve a reference:</P>
- <PRE>
- $title = $refs->get("document title");</PRE>
- <P>To return the number of references changed since the last run:</P>
- <PRE>
- $num = $refs->changed;</PRE>
- <P>To print a LaTeX-like warning if any references have changed:</P>
- <PRE>
- $refs->warn;</PRE>
- <P>
- <HR>
- <H1><A NAME="description">DESCRIPTION</A></H1>
- <P>This library can be used together with the <STRONG>SGMLS</STRONG> package to keep
- track of forward references from one run to another, like the <STRONG>LaTeX</STRONG>
- <CODE>.aux</CODE> files. Each reference manager is an object which reads and
- then rewrites a file of perl source, with the file name provided by
- the caller.</P>
- <P>Example:</P>
- <PRE>
- # Start up the reference manager before the parse.
- sgml('start', sub { $refs = new SGMLS::Refs("foo.refs"); });</PRE>
- <PRE>
- # Warn about any changed references at the end.
- sgml('end', sub { $refs->warn; });</PRE>
- <PRE>
- # Look up the title from the last parse, if available.
- sgml('<div>', sub {
- my $element = shift;
- my $id = $element->attribute(ID)->value;
- my $title = $refs->get("title:$id") || "[no title available]";</PRE>
- <PRE>
- $current_div_id = $id;</PRE>
- <PRE>
- output "\\section{$title}\n\n";
- });</PRE>
- <PRE>
- # Save the title for the next parse.
- sgml('<head>', sub { push_output('string'); });
- sgml('</head>', sub {
- my $title = pop_output();
- my $id = $current_div_id;</PRE>
- <PRE>
- $refs->put("title:$id",$title);
- });</PRE>
- <P>
- <HR>
- <H1><A NAME="author and copyright">AUTHOR AND COPYRIGHT</A></H1>
- <P>Copyright 1994 and 1995 by David Megginson,
- <CODE>dmeggins@aix1.uottawa.ca</CODE>. Distributed under the terms of the Gnu
- General Public License (version 2, 1991) -- see the file <CODE>COPYING</CODE>
- which is included in the <STRONG>SGMLS.pm</STRONG> distribution.</P>
- <P>
- <HR>
- <H1><A NAME="see also:">SEE ALSO:</A></H1>
- <P><A HREF="../../../site/lib/SGMLS.html">the SGMLS manpage</A>, <A HREF="../../../site/lib/SGMLS/Output.html">the SGMLS::Output manpage</A>.</P>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> main/site/lib/SGMLS/Refs.pm</P></STRONG>
- </TD></TR>
- </TABLE>
-
- </BODY>
-
- </HTML>
-