perlSGML -- SGML::Opt

## Name

SGML::Opt - command-line option parsing for SGML::* programs

## Synopsis

      use SGML::Opt;

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

## Description

SGML::Opt provides common base for command-line option parsing for SGML::* programs.

## Exported Variables

$Debug

  Flag if the -debug or -verbose option was specified.

$Description

  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 Usage function.

$Help

  Flag if the -help option was specified.

$Prog

  Name of the program.

$Synopsis

  Variable that the application can define that represents the synopsis output generated by the Usage function.

@Catalogs

  List of SGML Open catalags specified by the -catalog option. Mulitple catalogs are specified by mulitple -catalog options.

@IgnParmEnts

  List of parameter entities that should be defined to "`IGNORE`" via the -ignore option. Mulitple parameter entities are specified by mulitple -ignore options.

@IncParmEnts

  List of parameter entities that should be defined to "`INCLUDE`" via the -include option. Mulitple parameter entities are specified by mulitple -include options.

%OptValues

  Hash containing values of command-line options. Keys are the option name. The values' types are dependent on the option specification.

## Exported Functions

### AddOptions

        AddOptions(
    	$opt_spec1, $desc1,
    	$opt_spec2, $desc2,
    	$opt_spec3, $desc3,
    	...
        );

#### Parameters:

LIST
  List of spec/description pairs.

#### Return:

N/A

#### Description:

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

### GetOptions

        GetOptions(
    	$opt_spec1, $desc1,
    	$opt_spec2, $desc2,
    	$opt_spec3, $desc3,
    	...
        );

#### Parameters:

LIST
  List of spec/description pairs.

#### Return:

1 on success, 0 on error.

#### Description:

GetOptions parses the command-line (`@ARGV`) and fills the `%OptValues` hash. The keys of the `%OptValues` 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 Getopt::Long module.

A list of spec/description pairs can be passed into GetOptions just like AddOptions.

### Usage

Usage prints out usage information to STDOUT.

## See Also

perl(1), Getopt::Long(3)

## Availability

This software is part of the perlSGML package; see (http://www.oac.uci.edu/indiv/ehood/perlSGML.html)

## Author