This utility subroutine can be used within any subroutine, evaluator or
filter which uses options. It provides a uniform way to set default
options. It should be preceeded by assign_option_aliases. This is
principally intended for use in macros.
$rh_options -- reference to the hash containing the options received by the parent subroutine
contains a list of possible options and their default values allowed by
the parent subroutine.
Action All default options which are not already defined in the
received option hash (%$rh_options) are defined with the prescribed
default options. If there are any options in %$rh_options which do not
have a corresponding entry in the hash of default options an error will
be signaled, UNLESS the option 'allow_unknown_aliases' in the default
option hash is set to 1 in which case unknown options in the received
option hash do not trigger an error.
Examples Notes Setting 'allow_unknown_aliases' to 1 allows the use of a
single long option hash for several subroutines. Each subroutine will
take only the options it needs and will ignore the others without
triggering an error. This can be very convenient, however in this case
there is no error checking for misspelled option names. Whenever
possible subroutines that will be used directly by authors of problems
should set the 'allow_unknown_aliases' option to false ( or
equivalently, omit it completely) in order to provide better error
checking when writing problems.
See Also assign_option_aliases
<| Post or View Comments |>