man News::FormArticle () - derivative of News::Article

NAME

News::FormArticle - derivative of News::Article

SYNOPSIS

  use News::FormArticle;

See below for functions available.

DESCRIPTION

Like News::Article, but designed to be constructed from a file containing form text with substitutions.

Currently, the source text is substituted as follows:

Variables are denoted by CW$NAME or CW@NAME (where NAME is any simple identifier). (The sequences $$ and @@ denote literal $ and @ characters.) Variables of the form CW$NAME are expected to supply scalar values which are interpolated; variables of the form CW@NAME are expected to supply lists (or references to arrays) which are interpolated with separating newlines.

Values of variables are found by consulting the list of sources supplied. Each source may be either a reference to a hash, or a reference to code.

Source hashes may contain as values either the desired value (scalar or reference to array), or a typeglob, or a code reference which will be called to return the result. (Since typeglobs are allowed values, it is possible to supply a reference to a module symbol table as a valid source.)

Code references supplied as sources are invoked with the variable name (including the leading $ or @) as the only parameter. In the degenerate case, all variables accessible in the source scope may be made available for interpolation by supplying the following as a source:

  sub { eval shift }

If multiple sources are supplied, then each is consulted in turn until a defined value is found.

USAGE

  use News::FormArticle;

Exports nothing.

Constructor

new ( FILE [, SOURCE [...]] )
Construct an article from the specified file, performing variable substitution with values supplied by the CWSOURCE parameters (see Description). FILE is any form of data recognised by News::Article\'s read() method.

AUTHOR

Andrew Gierth <andrew@erlenstar.demon.co.uk>

COPYRIGHT

Copyright 1997 Andrew Gierth <andrew@erlenstar.demon.co.uk> This code may be used and/or distributed under the same terms as Perl itself.