home *** CD-ROM | disk | FTP | other *** search
-
- <HTML>
- <HEAD>
- <TITLE>SGMLS::Output - Stack-based Output Procedures</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> SGMLS::Output - Stack-based Output Procedures</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::Output - Stack-based Output Procedures</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::Output;</PRE>
- <P>To print a string to the current output destination:</P>
- <PRE>
- output($data);</PRE>
- <P>To push a new output level to the filehandle DATA:</P>
- <PRE>
- push_output('handle',DATA);</PRE>
- <P>To push a new output level to the file ``foo.data'' (which will be
- opened and closed automatically):</P>
- <PRE>
- push_output('file','foo.data');</PRE>
- <P>To push a new output level to a pipe to the shell command ``sort'':</P>
- <PRE>
- push_output('pipe','sort');</PRE>
- <P>To push a new output level <EM>appending</EM> to the file ``foo.data'':</P>
- <PRE>
- push_output('append','foo.data');</PRE>
- <P>To push a new output level to an empty string:</P>
- <PRE>
- push_output('string');</PRE>
- <P>To push a new output level appending to the string ``David is '':</P>
- <PRE>
- push_output('string',"David is ");</PRE>
- <P>To push a new output level to The Great Beyond:</P>
- <PRE>
- push_output('nul');</PRE>
- <P>To revert to the previous output level:</P>
- <PRE>
- pop_output();</PRE>
- <P>To revert to the previous output level, returning the contents of an
- output string:</P>
- <PRE>
- $data = pop_output();</PRE>
- <P>
- <HR>
- <H1><A NAME="description">DESCRIPTION</A></H1>
- <P>This library allows redirectable, stack-based output to files, pipes,
- handles, strings, or nul. It is especially useful for packages like
- <A HREF="../../../site/lib/SGMLS.html">the SGMLS manpage</A>, since handlers for individual <STRONG>SGML</STRONG> elements can
- temporarily change and restore the default output destination. It is
- also particularly useful for capturing the contents of an element (and
- its sub-elements) in a string.</P>
- <P>Example:</P>
- <PRE>
- sgmls('<title>', sub{ push_output('string'); });
- sgmls('</title>', sub{ $title = pop_output(); });</PRE>
- <P>In between, anything sent to <STRONG>output</STRONG> (such as CDATA) will be
- accumulated in the string returned from <STRONG>pop_output()</STRONG>.</P>
- <P>Example:</P>
- <PRE>
- sgmls('<tei.header>', sub { push_output('nul'); });
- sgmls('</tei.header>', sub { pop_output(); });</PRE>
- <P>All output will be ignored until the header has finished.</P>
- <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>.</P>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> SGMLS::Output - Stack-based Output Procedures</P></STRONG>
- </TD></TR>
- </TABLE>
-
- </BODY>
-
- </HTML>
-