FormArticle(3pm)
πΈ NAME πΈ
News::FormArticle β a whole derivative of News::Article, bestie. Like its cooler cousin, but with form-text energy π
β¨ SYNOPSIS β¨
use News::FormArticle;
okay so that's the whole vibe up top. For the actual functions, see below π
π DESCRIPTION π
So it's giving News::Article, right? But this one is built different β literally. It's designed to be constructed from a file that's got form text in it, with substitutions happening in there. π
Currently, the source text gets substituted like this:
Variables are denoted by $NAME or @NAME β and NAME is any simple identifier, no cap. (Also, the sequences $$ and @@ mean a literal $ and @ character, so you can escape them.) Variables of the form $NAME are expected to supply scalar values, which get interpolated. Variables of the form @NAME are expected to supply lists (or references to arrays), and those get interpolated with separating newlines. π¦
Values of variables are found by consulting the list of sources you supplied. Each source can be either a reference to a hash, or a reference to code. β¨
Source hashes may contain, as values, either:
- the desired value itself (scalar or reference to array), or
- a typeglob, or
- a code reference which will be called to return the result.
(and since typeglobs are allowed as values, it is possible to supply a reference to a module symbol table as a valid source. iconic behavior honestly π)
Code references supplied as sources get 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 this as a source:
sub { eval shift }
If multiple sources are supplied, then each is consulted in turn until a defined value is found. first one to show up with actual info wins, periodt π«Ά
π USAGE π
use News::FormArticle;
Exports nothing. she's private like that π
π§ Constructor π§
new ( FILE [, SOURCE [...]] )β Construct an article from the specifiedFILE, performing variable substitution with the values supplied by theSOURCEparameters (peep the Description above for how that works).FILEis any form of data recognised byNews::Article'sread()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.
and that's the whole page, bestie πΈ this was FormArticle(3pm) from the User Contributed Perl Documentation, riding along with perl v5.36.0, dated 2022-10-15 β slay, go interpolate something π
β¨
π¦ where this page comes from
- ubuntu noble: libnews-article-perl 1.27-12 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libnews-article-perl 1.27-12 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libnews-article-perl 1.27-12 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms