The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
<html>
<head>
<title>perlSGML -- SGML::Opt</title>
<link rev="made" href="mailto:ehood@medusa.acs.uci.edu">
</head>


<!-- =================================================================== -->
<hr><h2><a name="Name">Name</a></h2>

<p>SGML::Opt - command-line option parsing for SGML::* programs</p>

<!-- =================================================================== -->
<hr><h2><a name="Synopsis">Synopsis</a></h2>
<pre>
  use SGML::Opt;

  AddOptions('opt1=s', "opt1 description",
             'opt2=s', "opt2 description");
  GetOptions();
  $opt1_string = $OptValues{'opt1'};
</pre>

<!-- =================================================================== -->
<hr><h2><a name="Description">Description</a></h2>

<p><strong>SGML::Opt</strong> provides common base for command-line
option parsing for SGML::* programs.
</p>

<!-- =================================================================== -->
<hr><h2><a name="Exported Variables">Exported Variables</a></h2>

<dl>

<dt><strong>$Debug</strong></dt><dd>
<p>Flag if the <strong>-debug</strong> or <strong>-verbose</strong>
option was specified.
</p>

<dt><strong>$Description</strong></dt><dd>
<p>Variable that the application can define to give a brief description
of the application.  This is defines the description part of the
output generated by the <strong>Usage</strong> function.
</p>

<dt><strong>$Help</strong></dt><dd>
<p>Flag if the <strong>-help</strong> option was specified.
</p>

<dt><strong>$Prog</strong></dt><dd>
<p>Name of the program.
</p>

<dt><strong>$Synopsis</strong></dt><dd>
<p>Variable that the application can define that represents the
synopsis output generated by the <strong>Usage</strong> function.
</p>

<dt><strong>@Catalogs</strong></dt><dd>
<p>List of SGML Open catalags specified by the <strong>-catalog</strong> option.
Mulitple catalogs are specified by mulitple <strong>-catalog</strong> options.
</p>

<dt><strong>@IgnParmEnts</strong></dt><dd>
<p>List of parameter entities that should be defined to "<tt>IGNORE</tt>"
via the <strong>-ignore</strong> option.  Mulitple parameter entities
are specified by mulitple <strong>-ignore</strong> options.
</p>

<dt><strong>@IncParmEnts</strong></dt><dd>
<p>List of parameter entities that should be defined to "<tt>INCLUDE</tt>"
via the <strong>-include</strong> option.  Mulitple parameter entities
are specified by mulitple <strong>-include</strong> options.
</p>

<dt><strong>%OptValues</strong></dt><dd>
<p>Hash containing values of command-line options.  Keys are
the option name.  The values' types are dependent on the option
specification.
</p>

</dl>

<!-- =================================================================== -->
<hr><h2><a name="Exported Functions">Exported Functions</a></h2>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<hr size=0 width="50%" align=left noshade>
<h3><a name="AddOptions">AddOptions</a></h3>
<pre>
    <b>AddOptions</b>(
	<var>$opt_spec1</var>, <var>$desc1</var>,
	<var>$opt_spec2</var>, <var>$desc2</var>,
	<var>$opt_spec3</var>, <var>$desc3</var>,
	...
    );
</pre>

<h4>Parameters:</h4>
<dl>
<dt><var>LIST</var></dt><dd>
List of spec/description pairs.
</dl>

<h4>Return:</h4>
<p>N/A
</p>

<h4>Description:</h4>
<p><strong>AddOptions</strong> takes a list of spec/description pairs.
The spec is the option specification in the same format as the
<strong>Getopt::Long</strong> module.  Descriptions are brief
descriptions of the associated option.  The descriptions are used
by the <strong>Usage</strong> function.  Any specifications are
added to the current option specifications and will be used by the
<a href="#GetOptions"><strong>GetOptions</strong></a> function.
</p>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<hr size=0 width="50%" align=left noshade>
<h3><a name="GetOptions">GetOptions</a></h3>
<pre>
    <b>GetOptions</b>(
	<var>$opt_spec1</var>, <var>$desc1</var>,
	<var>$opt_spec2</var>, <var>$desc2</var>,
	<var>$opt_spec3</var>, <var>$desc3</var>,
	...
    );
</pre>

<h4>Parameters:</h4>
<dl>
<dt><var>LIST</var></dt><dd>
List of spec/description pairs.
</dl>

<h4>Return:</h4>
<p>1 on success, 0 on error.
</p>

<h4>Description:</h4>
<p><strong>GetOptions</strong> parses the command-line
(<tt>@ARGV</tt>) and fills the <tt><b>%OptValues</b></tt> hash.
The keys of the <tt><b>%OptValues</b></tt> has will be the options
defined on the command-line.  There associated values are dependent
on the option specifications which follows the same rules as the
<strong>Getopt::Long</strong> module.
</p>
<p>A list of spec/description pairs can be passed
into <strong>GetOptions</strong> just like <strong>AddOptions</strong>.
</p>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<hr size=0 width="50%" align=left noshade>
<h3><a name="Usage">Usage</a></h3>

<p><strong>Usage</strong> prints out usage information to STDOUT.
</p>

<!-- =================================================================== -->
<hr><h2><a name="See Also">See Also</a></h2>

<p>
perl(1),
Getopt::Long(3)
</p>

<!-- ================================================================== -->
<!--	@(#)  avail.mod 1.2 97/09/16 @(#)
  -->
<hr>
<h2><a name="availability">Availability</a></h2>
<p>This software is part of the <em>perlSGML</em> package; see
(<a href="http://www.oac.uci.edu/indiv/ehood/perlSGML.html"
>http://www.oac.uci.edu/indiv/ehood/perlSGML.html</a>)
</p>

<!--	@(#) author.mod 1.2 97/09/16 15:50:29 @(#)
  -->
<hr>
<h2><a name="author">Author</a></h2>
<address>
<a href="http://www.oac.uci.edu/indiv/ehood/">Earl Hood</a><br>
<a href="mailto:ehood@medusa.acs.uci.edu"
>ehood@medusa.acs.uci.edu</a><br>
Copyright &#169; 1997<br>
</address>


<!-- ================================================================== -->
<hr>
<address>
97/09/18 14:32:46
</address>
</body></html>