.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43)
.\"
.\" 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::Text 3perl"
.TH Pod::Text 3perl "2023-11-25" "perl v5.36.0" "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::Text \- Convert POD data to formatted text
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 2
\& use Pod::Text;
\& my $parser = Pod::Text\->new (sentence => 1, width => 78);
\&
\& # Read POD from STDIN and write to STDOUT.
\& $parser\->parse_from_filehandle;
\&
\& # Read POD from file.pod and write to file.txt.
\& $parser\->parse_from_file (\*(Aqfile.pod\*(Aq, \*(Aqfile.txt\*(Aq);
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
Pod::Text is a module that can convert documentation in the \s-1POD\s0 format
(the preferred language for documenting Perl) into formatted text. It
uses no special formatting controls or codes whatsoever, and its output is
therefore suitable for nearly any device.
.PP
As a derived class from Pod::Simple, Pod::Text supports the same methods and
interfaces. See Pod::Simple for all the details; briefly, one creates a
new parser with \f(CW\*(C`Pod::Text\->new()\*(C'\fR and then normally calls \fBparse_file()\fR.
.PP
\&\fBnew()\fR can take options, in the form of key/value pairs, that control the
behavior of the parser. The currently recognized options are:
.IP "alt" 4
.IX Item "alt"
If set to a true value, selects an alternate output format that, among other
things, uses a different heading style and marks \f(CW\*(C`=item\*(C'\fR entries with a
colon in the left margin. Defaults to false.
.IP "code" 4
.IX Item "code"
If set to a true value, the non-POD parts of the input file will be included
in the output. Useful for viewing code documented with \s-1POD\s0 blocks with the
\&\s-1POD\s0 rendered and the code left intact.
.IP "errors" 4
.IX Item "errors"
How to report errors. \f(CW\*(C`die\*(C'\fR says to throw an exception on any \s-1POD\s0
formatting error. \f(CW\*(C`stderr\*(C'\fR says to report errors on standard error, but
not to throw an exception. \f(CW\*(C`pod\*(C'\fR says to include a \s-1POD ERRORS\s0 section
in the resulting documentation summarizing the errors. \f(CW\*(C`none\*(C'\fR ignores
\&\s-1POD\s0 errors entirely, as much as possible.
.Sp
The default is \f(CW\*(C`pod\*(C'\fR.
.IP "indent" 4
.IX Item "indent"
The number of spaces to indent regular text, and the default indentation for
\&\f(CW\*(C`=over\*(C'\fR blocks. Defaults to 4.
.IP "loose" 4
.IX Item "loose"
If set to a true value, a blank line is printed after a \f(CW\*(C`=head1\*(C'\fR heading.
If set to false (the default), no blank line is printed after \f(CW\*(C`=head1\*(C'\fR,
although one is still printed after \f(CW\*(C`=head2\*(C'\fR. This is the default because
it's the expected formatting for manual pages; if you're formatting
arbitrary text documents, setting this to true may result in more pleasing
output.
.IP "margin" 4
.IX Item "margin"
The width of the left margin in spaces. Defaults to 0. This is the margin
for all text, including headings, not the amount by which regular text is
indented; for the latter, see the \fIindent\fR option. To set the right
margin, see the \fIwidth\fR option.
.IP "nourls" 4
.IX Item "nourls"
Normally, L<> formatting codes with a \s-1URL\s0 but anchor text are formatted
to show both the anchor text and the \s-1URL.\s0 In other words:
.Sp
.Vb 1
\& L
.Ve
.Sp
is formatted as:
.Sp
.Vb 1
\& foo
.Ve
.Sp
This option, if set to a true value, suppresses the \s-1URL\s0 when anchor text
is given, so this example would be formatted as just \f(CW\*(C`foo\*(C'\fR. This can
produce less cluttered output in cases where the URLs are not particularly
important.
.IP "quotes" 4
.IX Item "quotes"
Sets the quote marks used to surround C<> text. If the value is a
single character, it is used as both the left and right quote. Otherwise,
it is split in half, and the first half of the string is used as the left
quote and the second is used as the right quote.
.Sp
This may also be set to the special value \f(CW\*(C`none\*(C'\fR, in which case no quote
marks are added around C<> text.
.IP "sentence" 4
.IX Item "sentence"
If set to a true value, Pod::Text will assume that each sentence ends in two
spaces, and will try to preserve that spacing. If set to false, all
consecutive whitespace in non-verbatim paragraphs is compressed into a
single space. Defaults to false.
.IP "stderr" 4
.IX Item "stderr"
Send error messages about invalid \s-1POD\s0 to standard error instead of
appending a \s-1POD ERRORS\s0 section to the generated output. This is
equivalent to setting \f(CW\*(C`errors\*(C'\fR to \f(CW\*(C`stderr\*(C'\fR if \f(CW\*(C`errors\*(C'\fR is not already
set. It is supported for backward compatibility.
.IP "utf8" 4
.IX Item "utf8"
By default, Pod::Text uses the same output encoding as the input encoding
of the \s-1POD\s0 source (provided that Perl was built with PerlIO; otherwise, it
doesn't encode its output). If this option is given, the output encoding
is forced to \s-1UTF\-8.\s0
.Sp
Be aware that, when using this option, the input encoding of your \s-1POD\s0
source should be properly declared unless it's US-ASCII. Pod::Simple will
attempt to guess the encoding and may be successful if it's Latin\-1 or
\&\s-1UTF\-8,\s0 but it will produce warnings. Use the \f(CW\*(C`=encoding\*(C'\fR command to
declare the encoding. See \fBperlpod\fR\|(1) for more information.
.IP "width" 4
.IX Item "width"
The column at which to wrap text on the right-hand side. Defaults to 76.
.PP
The standard Pod::Simple method \fBparse_file()\fR takes one argument naming the
\&\s-1POD\s0 file to read from. By default, the output is sent to \f(CW\*(C`STDOUT\*(C'\fR, but
this can be changed with the \fBoutput_fh()\fR method.
.PP
The standard Pod::Simple method \fBparse_from_file()\fR takes up to two
arguments, the first being the input file to read \s-1POD\s0 from and the second
being the file to write the formatted output to.
.PP
You can also call \fBparse_lines()\fR to parse an array of lines or
\&\fBparse_string_document()\fR to parse a document already in memory. As with
\&\fBparse_file()\fR, \fBparse_lines()\fR and \fBparse_string_document()\fR default to sending
their output to \f(CW\*(C`STDOUT\*(C'\fR unless changed with the \fBoutput_fh()\fR method. Be
aware that \fBparse_lines()\fR and \fBparse_string_document()\fR both expect raw bytes,
not decoded characters.
.PP
To put the output from any parse method into a string instead of a file
handle, call the \fBoutput_string()\fR method instead of \fBoutput_fh()\fR.
.PP
See Pod::Simple for more specific details on the methods available to
all derived parsers.
.SH "DIAGNOSTICS"
.IX Header "DIAGNOSTICS"
.IP "Bizarre space in item" 4
.IX Item "Bizarre space in item"
.PD 0
.IP "Item called without tag" 4
.IX Item "Item called without tag"
.PD
(W) Something has gone wrong in internal \f(CW\*(C`=item\*(C'\fR processing. These
messages indicate a bug in Pod::Text; you should never see them.
.ie n .IP "Can't open %s for reading: %s" 4
.el .IP "Can't open \f(CW%s\fR for reading: \f(CW%s\fR" 4
.IX Item "Can't open %s for reading: %s"
(F) Pod::Text was invoked via the compatibility mode \fBpod2text()\fR interface
and the input file it was given could not be opened.
.ie n .IP "Invalid errors setting ""%s""" 4
.el .IP "Invalid errors setting ``%s''" 4
.IX Item "Invalid errors setting %s"
(F) The \f(CW\*(C`errors\*(C'\fR parameter to the constructor was set to an unknown value.
.ie n .IP "Invalid quote specification ""%s""" 4
.el .IP "Invalid quote specification ``%s''" 4
.IX Item "Invalid quote specification %s"
(F) The quote specification given (the \f(CW\*(C`quotes\*(C'\fR option to the
constructor) was invalid. A quote specification must be either one
character long or an even number (greater than one) characters long.
.IP "\s-1POD\s0 document had syntax errors" 4
.IX Item "POD document had syntax errors"
(F) The \s-1POD\s0 document being formatted had syntax errors and the \f(CW\*(C`errors\*(C'\fR
option was set to \f(CW\*(C`die\*(C'\fR.
.SH "BUGS"
.IX Header "BUGS"
Encoding handling assumes that PerlIO is available and does not work
properly if it isn't. The \f(CW\*(C`utf8\*(C'\fR option is therefore not supported
unless Perl is built with PerlIO support.
.SH "CAVEATS"
.IX Header "CAVEATS"
If Pod::Text is given the \f(CW\*(C`utf8\*(C'\fR option, the encoding of its output file
handle will be forced to \s-1UTF\-8\s0 if possible, overriding any existing
encoding. This will be done even if the file handle is not created by
Pod::Text and was passed in from outside. This maintains consistency
regardless of \s-1PERL_UNICODE\s0 and other settings.
.PP
If the \f(CW\*(C`utf8\*(C'\fR option is not given, the encoding of its output file handle
will be forced to the detected encoding of the input \s-1POD,\s0 which preserves
whatever the input text is. This ensures backward compatibility with
earlier, pre-Unicode versions of this module, without large numbers of
Perl warnings.
.PP
This is not ideal, but it seems to be the best compromise. If it doesn't
work for you, please let me know the details of how it broke.
.SH "NOTES"
.IX Header "NOTES"
This is a replacement for an earlier Pod::Text module written by Tom
Christiansen. It has a revamped interface, since it now uses Pod::Simple,
but an interface roughly compatible with the old \fBPod::Text::pod2text()\fR
function is still available. Please change to the new calling convention,
though.
.PP
The original Pod::Text contained code to do formatting via termcap
sequences, although it wasn't turned on by default and it was problematic to
get it to work at all. This rewrite doesn't even try to do that, but a
subclass of it does. Look for Pod::Text::Termcap.
.SH "AUTHOR"
.IX Header "AUTHOR"
Russ Allbery , based \fIvery\fR heavily on the original
Pod::Text by Tom Christiansen and its conversion to
Pod::Parser by Brad Appleton . Sean Burke's initial
conversion of Pod::Man to use Pod::Simple provided much-needed guidance on
how to use Pod::Simple.
.SH "COPYRIGHT AND LICENSE"
.IX Header "COPYRIGHT AND LICENSE"
Copyright 1999\-2002, 2004, 2006, 2008\-2009, 2012\-2016, 2018\-2019 Russ Allbery
.PP
This program is free software; you may redistribute it and/or modify it
under the same terms as Perl itself.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
Pod::Simple, Pod::Text::Termcap, \fBperlpod\fR\|(1), \fBpod2text\fR\|(1)
.PP
The current version of this module is always available from its web site at
. It is also part of the
Perl core distribution as of 5.6.0.