.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Pod::ParseUtils 3perl" .TH Pod::ParseUtils 3perl "2020-06-07" "perl v5.30.3" "Perl Programmers Reference Guide" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Pod::ParseUtils \- helpers for POD parsing and conversion .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Pod::ParseUtils; \& \& my $list = new Pod::List; \& my $link = Pod::Hyperlink\->new(\*(AqPod::Parser\*(Aq); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fB\s-1NOTE:\s0 This module is considered legacy; modern Perl releases (5.18 and higher) are going to remove Pod-Parser from core and use Pod-Simple for all things \s-1POD.\s0\fR .PP \&\fBPod::ParseUtils\fR contains a few object-oriented helper packages for \&\s-1POD\s0 parsing and processing (i.e. in \s-1POD\s0 formatters and translators). .SS "Pod::List" .IX Subsection "Pod::List" \&\fBPod::List\fR can be used to hold information about \s-1POD\s0 lists (written as =over ... =item ... =back) for further processing. The following methods are available: .IP "Pod::List\->\fBnew()\fR" 4 .IX Item "Pod::List->new()" Create a new list object. Properties may be specified through a hash reference like this: .Sp .Vb 1 \& my $list = Pod::List\->new({ \-start => $., \-indent => 4 }); .Ve .Sp See the individual methods/properties for details. .ie n .IP "$list\->\fBfile()\fR" 4 .el .IP "\f(CW$list\fR\->\fBfile()\fR" 4 .IX Item "$list->file()" Without argument, retrieves the file name the list is in. This must have been set before by either specifying \fB\-file\fR in the \fB\fBnew()\fB\fR method or by calling the \fB\fBfile()\fB\fR method with a scalar argument. .ie n .IP "$list\->\fBstart()\fR" 4 .el .IP "\f(CW$list\fR\->\fBstart()\fR" 4 .IX Item "$list->start()" Without argument, retrieves the line number where the list started. This must have been set before by either specifying \fB\-start\fR in the \&\fB\fBnew()\fB\fR method or by calling the \fB\fBstart()\fB\fR method with a scalar argument. .ie n .IP "$list\->\fBindent()\fR" 4 .el .IP "\f(CW$list\fR\->\fBindent()\fR" 4 .IX Item "$list->indent()" Without argument, retrieves the indent level of the list as specified in \f(CW\*(C`=over n\*(C'\fR. This must have been set before by either specifying \&\fB\-indent\fR in the \fB\fBnew()\fB\fR method or by calling the \fB\fBindent()\fB\fR method with a scalar argument. .ie n .IP "$list\->\fBtype()\fR" 4 .el .IP "\f(CW$list\fR\->\fBtype()\fR" 4 .IX Item "$list->type()" Without argument, retrieves the list type, which can be an arbitrary value, e.g. \f(CW\*(C`OL\*(C'\fR, \f(CW\*(C`UL\*(C'\fR, ... when thinking the \s-1HTML\s0 way. This must have been set before by either specifying \&\fB\-type\fR in the \fB\fBnew()\fB\fR method or by calling the \fB\fBtype()\fB\fR method with a scalar argument. .ie n .IP "$list\->\fBrx()\fR" 4 .el .IP "\f(CW$list\fR\->\fBrx()\fR" 4 .IX Item "$list->rx()" Without argument, retrieves a regular expression for simplifying the individual item strings once the list type has been determined. Usage: E.g. when converting to \s-1HTML,\s0 one might strip the leading number in an ordered list as \f(CW\*(C`
    \*(C'\fR already prints numbers itself. This must have been set before by either specifying \&\fB\-rx\fR in the \fB\fBnew()\fB\fR method or by calling the \fB\fBrx()\fB\fR method with a scalar argument. .ie n .IP "$list\->\fBitem()\fR" 4 .el .IP "\f(CW$list\fR\->\fBitem()\fR" 4 .IX Item "$list->item()" Without argument, retrieves the array of the items in this list. The items may be represented by any scalar. If an argument has been given, it is pushed on the list of items. .ie n .IP "$list\->\fBparent()\fR" 4 .el .IP "\f(CW$list\fR\->\fBparent()\fR" 4 .IX Item "$list->parent()" Without argument, retrieves information about the parent holding this list, which is represented as an arbitrary scalar. This must have been set before by either specifying \&\fB\-parent\fR in the \fB\fBnew()\fB\fR method or by calling the \fB\fBparent()\fB\fR method with a scalar argument. .ie n .IP "$list\->\fBtag()\fR" 4 .el .IP "\f(CW$list\fR\->\fBtag()\fR" 4 .IX Item "$list->tag()" Without argument, retrieves information about the list tag, which can be any scalar. This must have been set before by either specifying \&\fB\-tag\fR in the \fB\fBnew()\fB\fR method or by calling the \fB\fBtag()\fB\fR method with a scalar argument. .SS "Pod::Hyperlink" .IX Subsection "Pod::Hyperlink" \&\fBPod::Hyperlink\fR is a class for manipulation of \s-1POD\s0 hyperlinks. Usage: .PP .Vb 1 \& my $link = Pod::Hyperlink\->new(\*(Aqalternative text|page/"section in page"\*(Aq); .Ve .PP The \fBPod::Hyperlink\fR class is mainly designed to parse the contents of the \&\f(CW\*(C`L<...>\*(C'\fR sequence, providing a simple interface for accessing the different parts of a \s-1POD\s0 hyperlink for further processing. It can also be used to construct hyperlinks. .IP "Pod::Hyperlink\->\fBnew()\fR" 4 .IX Item "Pod::Hyperlink->new()" The \fB\fBnew()\fB\fR method can either be passed a set of key/value pairs or a single scalar value, namely the contents of a \f(CW\*(C`L<...>\*(C'\fR sequence. An object of the class \f(CW\*(C`Pod::Hyperlink\*(C'\fR is returned. The value \f(CW\*(C`undef\*(C'\fR indicates a failure, the error message is stored in \f(CW$@\fR. .ie n .IP "$link\->parse($string)" 4 .el .IP "\f(CW$link\fR\->parse($string)" 4 .IX Item "$link->parse($string)" This method can be used to (re)parse a (new) hyperlink, i.e. the contents of a \f(CW\*(C`L<...>\*(C'\fR sequence. The result is stored in the current object. Warnings are stored in the \fBwarnings\fR property. E.g. sections like \f(CW\*(C`L\*(C'\fR are deprecated, as they do not point to Perl documents. \f(CW\*(C`L\*(C'\fR is wrong as well, the manpage section can simply be dropped. .ie n .IP "$link\->markup($string)" 4 .el .IP "\f(CW$link\fR\->markup($string)" 4 .IX Item "$link->markup($string)" Set/retrieve the textual value of the link. This string contains special markers \f(CW\*(C`P<>\*(C'\fR and \f(CW\*(C`Q<>\*(C'\fR that should be expanded by the translator's interior sequence expansion engine to the formatter-specific code to highlight/activate the hyperlink. The details have to be implemented in the translator. .ie n .IP "$link\->\fBtext()\fR" 4 .el .IP "\f(CW$link\fR\->\fBtext()\fR" 4 .IX Item "$link->text()" This method returns the textual representation of the hyperlink as above, but without markers (read only). Depending on the link type this is one of the following alternatives (the + and * denote the portions of the text that are marked up): .Sp .Vb 4 \& +perl+ L \& *$|* in +perlvar+ L \& *OPTIONS* in +perldoc+ L \& *DESCRIPTION* L<"DESCRIPTION"> .Ve .ie n .IP "$link\->\fBwarning()\fR" 4 .el .IP "\f(CW$link\fR\->\fBwarning()\fR" 4 .IX Item "$link->warning()" After parsing, this method returns any warnings encountered during the parsing process. .ie n .IP "$link\->\fBfile()\fR" 4 .el .IP "\f(CW$link\fR\->\fBfile()\fR" 4 .IX Item "$link->file()" .PD 0 .ie n .IP "$link\->\fBline()\fR" 4 .el .IP "\f(CW$link\fR\->\fBline()\fR" 4 .IX Item "$link->line()" .PD Just simple slots for storing information about the line and the file the link was encountered in. Has to be filled in manually. .ie n .IP "$link\->\fBpage()\fR" 4 .el .IP "\f(CW$link\fR\->\fBpage()\fR" 4 .IX Item "$link->page()" This method sets or returns the \s-1POD\s0 page this link points to. .ie n .IP "$link\->\fBnode()\fR" 4 .el .IP "\f(CW$link\fR\->\fBnode()\fR" 4 .IX Item "$link->node()" As above, but the destination node text of the link. .ie n .IP "$link\->\fBalttext()\fR" 4 .el .IP "\f(CW$link\fR\->\fBalttext()\fR" 4 .IX Item "$link->alttext()" Sets or returns an alternative text specified in the link. .ie n .IP "$link\->\fBtype()\fR" 4 .el .IP "\f(CW$link\fR\->\fBtype()\fR" 4 .IX Item "$link->type()" The node type, either \f(CW\*(C`section\*(C'\fR or \f(CW\*(C`item\*(C'\fR. As an unofficial type, there is also \f(CW\*(C`hyperlink\*(C'\fR, derived from e.g. \f(CW\*(C`L\*(C'\fR .ie n .IP "$link\->\fBlink()\fR" 4 .el .IP "\f(CW$link\fR\->\fBlink()\fR" 4 .IX Item "$link->link()" Returns the link as contents of \f(CW\*(C`L<>\*(C'\fR. Reciprocal to \fB\fBparse()\fB\fR. .SS "Pod::Cache" .IX Subsection "Pod::Cache" \&\fBPod::Cache\fR holds information about a set of \s-1POD\s0 documents, especially the nodes for hyperlinks. The following methods are available: .IP "Pod::Cache\->\fBnew()\fR" 4 .IX Item "Pod::Cache->new()" Create a new cache object. This object can hold an arbitrary number of \&\s-1POD\s0 documents of class Pod::Cache::Item. .ie n .IP "$cache\->\fBitem()\fR" 4 .el .IP "\f(CW$cache\fR\->\fBitem()\fR" 4 .IX Item "$cache->item()" Add a new item to the cache. Without arguments, this method returns a list of all cache elements. .ie n .IP "$cache\->find_page($name)" 4 .el .IP "\f(CW$cache\fR\->find_page($name)" 4 .IX Item "$cache->find_page($name)" Look for a \s-1POD\s0 document named \f(CW$name\fR in the cache. Returns the reference to the corresponding Pod::Cache::Item object or undef if not found. .SS "Pod::Cache::Item" .IX Subsection "Pod::Cache::Item" \&\fBPod::Cache::Item\fR holds information about individual \s-1POD\s0 documents, that can be grouped in a Pod::Cache object. It is intended to hold information about the hyperlink nodes of \s-1POD\s0 documents. The following methods are available: .IP "Pod::Cache::Item\->\fBnew()\fR" 4 .IX Item "Pod::Cache::Item->new()" Create a new object. .ie n .IP "$cacheitem\->\fBpage()\fR" 4 .el .IP "\f(CW$cacheitem\fR\->\fBpage()\fR" 4 .IX Item "$cacheitem->page()" Set/retrieve the \s-1POD\s0 document name (e.g. \*(L"Pod::Parser\*(R"). .ie n .IP "$cacheitem\->\fBdescription()\fR" 4 .el .IP "\f(CW$cacheitem\fR\->\fBdescription()\fR" 4 .IX Item "$cacheitem->description()" Set/retrieve the \s-1POD\s0 short description as found in the \f(CW\*(C`=head1 NAME\*(C'\fR section. .ie n .IP "$cacheitem\->\fBpath()\fR" 4 .el .IP "\f(CW$cacheitem\fR\->\fBpath()\fR" 4 .IX Item "$cacheitem->path()" Set/retrieve the \s-1POD\s0 file storage path. .ie n .IP "$cacheitem\->\fBfile()\fR" 4 .el .IP "\f(CW$cacheitem\fR\->\fBfile()\fR" 4 .IX Item "$cacheitem->file()" Set/retrieve the \s-1POD\s0 file name. .ie n .IP "$cacheitem\->\fBnodes()\fR" 4 .el .IP "\f(CW$cacheitem\fR\->\fBnodes()\fR" 4 .IX Item "$cacheitem->nodes()" Add a node (or a list of nodes) to the document's node list. Note that the order is kept, i.e. start with the first node and end with the last. If no argument is given, the current list of nodes is returned in the same order the nodes have been added. A node can be any scalar, but usually is a pair of node string and unique id for the \f(CW\*(C`find_node\*(C'\fR method to work correctly. .ie n .IP "$cacheitem\->find_node($name)" 4 .el .IP "\f(CW$cacheitem\fR\->find_node($name)" 4 .IX Item "$cacheitem->find_node($name)" Look for a node or index entry named \f(CW$name\fR in the object. Returns the unique id of the node (i.e. the second element of the array stored in the node array) or undef if not found. .ie n .IP "$cacheitem\->\fBidx()\fR" 4 .el .IP "\f(CW$cacheitem\fR\->\fBidx()\fR" 4 .IX Item "$cacheitem->idx()" Add an index entry (or a list of them) to the document's index list. Note that the order is kept, i.e. start with the first node and end with the last. If no argument is given, the current list of index entries is returned in the same order the entries have been added. An index entry can be any scalar, but usually is a pair of string and unique id. .SH "AUTHOR" .IX Header "AUTHOR" Please report bugs using . .PP Marek Rouchal , borrowing a lot of things from pod2man and pod2roff as well as other \s-1POD\s0 processing tools by Tom Christiansen, Brad Appleton and Russ Allbery. .PP \&\fBPod::ParseUtils\fR is part of the Pod::Parser distribution. .SH "SEE ALSO" .IX Header "SEE ALSO" pod2man, pod2roff, Pod::Parser, Pod::Checker, pod2html