POD2TEXT(1perl)
π POD2TEXT(1perl) β the perl girlies' guide to turning POD into pretty text β¨
okay bestie, so pod2text is a thing that exists and it is so useful, and also you're reading the 1perl manual section for it, which is the perl programmers reference guide era. let's get into it π«Ά
β¨ NAME β¨
pod2text β convert POD data to formatted ASCII text. that's it, that's the whole name. iconic. no notes. π
πΈ SYNOPSIS πΈ
here's how you actually call her:
pod2text [-aclostu] [--code] [-e encoding]
[--errors=style] [--guesswork=rule[,rule...]]
[-i indent] [-q quotes]
[--nourls] [--stderr] [-w width] [input [output ...]]
pod2text -h
look at all those little letters. each one does something. we'll get to them, don't stress π
π¦ DESCRIPTION π¦
so pod2text is a wrapper script around the Pod::Text family β her and all her subclasses. she uses them to generate formatted text from POD source. and she can optionally use either termcap sequences or ANSI color escape sequences to format the text. choices, we love choices. β¨
input is the file to read for POD source (the POD can be embedded in code, no big deal). if input isn't given, it defaults to "STDIN". output, if given, is the file to which to write the formatted output. if output isn't given, the formatted output is written to "STDOUT". and the way that you can process several POD files in the same pod2text invocation β saving module load and compile times, efficiency queen β is by providing multiple pairs of input and output files on the command line. π
by default, the output encoding is the same as the encoding of the input file, or UTF-8 if that encoding is not set (except on EBCDIC systems, you special little legacy gremlins). see the -e option to explicitly set the output encoding, and "Encoding" in Pod::Text for more discussion. π
π OPTIONS π
each option is annotated with the version of podlators in which that option was added with its current meaning. so yes, the little bracketed numbers matter, bestie, they're the lore.
-a,--altβ[1.00]use an alternate output format that, among other things, uses a different heading style and marks"=item"entries with a colon in the left margin. a little remix, a little alt-girl formatting. π--codeβ[1.11]include any non-POD text from the input file in the output as well. useful for viewing code documented with POD blocks with the POD rendered and the code left intact. best of both worlds, fr fr. π₯-c,--colorβ[1.00]format the output with ANSI color escape sequences. using this option requires thatTerm::ANSIColorbe installed on your system. no module, no rainbow, sorry. π-e encoding,--encoding=encodingβ[5.00]specifies the encoding of the output. encoding must be an encoding recognized by theEncodemodule (see Encode::Supported). if the output contains characters that cannot be represented in this encoding, that is an error that will be reported as configured by the"errors"option. if error handling is other than"die", the unrepresentable character will be replaced with theEncodesubstitution character (normally"?"). π
WARNING: the input encoding of the POD source is independent from the output encoding, and setting this option does not affect the interpretation of the POD input. unless your POD source is US-ASCII, its encoding should be declared with the"=encoding"command in the source, as near to the top of the file as possible. if this is not done,Pod::Simplewill will attempt to guess the encoding and may be successful if it's Latin-1 or UTF-8, but it will produce warnings. (yes, "will will" β that's what the page says, i'm keeping it, character for character, don't come for me π) see perlpod(1) for more information.
--errors=styleβ[2.5.0]set the error handling style."die"says to throw an exception on any POD formatting error."stderr"says to report errors on standard error, but not to throw an exception."pod"says to include a POD ERRORS section in the resulting documentation summarizing the errors."none"ignores POD errors entirely, as much as possible. the default is"die". π (dramatic, but correct.)--guesswork=rule[,rule...]β[5.01]by default,pod2textapplies some default formatting rules based on guesswork and regular expressions that are intended to make writing Perl documentation easier and require less explicit markup. these rules may not always be appropriate, particularly for documentation that isn't about Perl. this option allows turning all or some of it off. π§
the special rule "all" enables all guesswork. this is also the default for backward compatibility reasons. the special rule "none" disables all guesswork. otherwise, the value of this option should be a comma-separated list of one or more of the following keywords:
quotingβ if no guesswork is enabled, any text enclosed inC<>is surrounded by double quotes in nroff (terminal) output unless the contents are already quoted. when this guesswork is enabled, quote marks will also be suppressed for Perl variables, function names, function calls, numbers, and hex constants.
any unknown guesswork name is silently ignored (for potential future compatibility), so be careful about spelling. π like, actually careful. she will not tell you.
-i indent,--indent=indentβ[1.00]set the number of spaces to indent regular text, and the default indentation for"=over"blocks. defaults to 4 spaces if this option isn't given. we love a sensible default. β-h,--helpβ[1.00]print out usage information and exit. the classic. π«Ά-l,--looseβ[1.00]print a blank line after a"=head1"heading. normally, no blank line is printed after"=head1", although one is still printed after"=head2", because this is the expected formatting for manual pages; if you're formatting arbitrary text documents, using this option is recommended. breathing room for the headings, self-care. πΈ-m width,--left-margin=width,--margin=widthβ[1.24]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-ioption. don't get them mixed up, they are two different settings doing two different jobs. π--nourlsβ[2.5.0]normally,L<>formatting codes with a URL but anchor text are formatted to show both the anchor text and the URL. in other words:
L<foo|http://example.com/>
is formatted as:
foo <http://example.com/>
this flag, if given, suppresses the URL when anchor text is given, so this example would be formatted as just "foo". this can produce less cluttered output in cases where the URLs are not particularly important. clean lines only. β¨
-o,--overstrikeβ[1.06]format the output with overstrike printing. bold text is rendered as character, backspace, character. italics and file names are rendered as underscore, backspace, character. many pagers, such asless, know how to convert this to bold or underlined text. old school tech, still slaps. π₯-q quotes,--quotes=quotesβ[4.00]sets the quote marks used to surroundC<>text to quotes. if quotes 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. quotes may also be set to the special value"none", in which case no quote marks are added aroundC<>text. π-s,--sentenceβ[1.00]assume each sentence ends with two spaces and try to preserve that spacing. without this option, all consecutive whitespace in non-verbatim paragraphs is compressed into a single space. she squishes. π€--stderrβ[2.1.3]by default,pod2textdies if any errors are detected in the POD input. if--stderris given and no--errorsflag is present, errors are sent to standard error, butpod2textdoes not abort. this is equivalent to"--errors=stderr"and is supported for backward compatibility. blessed legacy behaviour. π-t,--termcapβ[1.00]try to determine the width of the screen and the bold and underline sequences for the terminal from termcap, and use that information in formatting the output. output will be wrapped at two columns less than the width of your terminal device. using this option requires that your system have a termcap file somewhere whereTerm::Capcan find it and requires that your system support termios. with this option, the output ofpod2textwill contain terminal control sequences for your current terminal type. π-u,--utf8β[2.2.0]set the output encoding to UTF-8. this is equivalent to"--encoding=UTF-8"and is supported for backward compatibility. the emoji-friendly one, love her. π-w,--width=width,-widthβ[1.00]the column at which to wrap text on the right-hand side. defaults to 76, unless-tis given, in which case it's two columns less than the width of your terminal device. π¦
π EXIT STATUS π
as long as all documents processed result in some output, even if that output includes errata (a "POD ERRORS" section generated with "--errors=pod"), pod2text will exit with status 0. if any of the documents being processed do not result in an output document, pod2text will exit with status 1. if there are syntax errors in a POD document being processed and the error handling style is set to the default of "die", pod2text will abort immediately with exit status 255. no cap. π
π DIAGNOSTICS π
if pod2text fails with errors, see Pod::Text and Pod::Simple for information about what those errors might mean. internally, it can also produce the following diagnostics:
-c (--color) requires Term::ANSIColor be installedβ (F)-cor--colorwere given, butTerm::ANSIColorcould not be loaded. πUnknown option: %sβ (F) an unknown command line option was given. π
in addition, other Getopt::Long error messages may result from invalid command-line options.
πΏ ENVIRONMENT πΏ
COLUMNSβ if-tis given,pod2textwill take the current width of your screen from this environment variable, if available. it overrides terminal width information inTERMCAP. πTERMCAPβ if-tis given,pod2textwill use the contents of this environment variable if available to determine the correct formatting sequences for your current terminal device. β¨
π AUTHOR π
Russ Allbery <rra@cpan.org>.
π COPYRIGHT AND LICENSE π
Copyright 1999-2001, 2004, 2006, 2008, 2010, 2012-2019, 2022, 2024 Russ Allbery <rra@cpan.org>
this program is free software; you may redistribute it and/or modify it under the same terms as Perl itself. π«Ά
π¦ SEE ALSO π¦
Encode::Supported, Pod::Text, Pod::Text::Color, Pod::Text::Overstrike, Pod::Text::Termcap, Pod::Simple, perlpod(1)
the current version of this script is always available from its web site at <https://www.eyrie.org/~eagle/software/podlators/>. it is also part of the Perl core distribution as of 5.6.0. iykyk. β
okay and that's the whole page bestie!! this was perl v5.44.0, dated 2026-10-17, and it lives at POD2TEXT(1perl) if you ever need to find her again. go forth and format. slay. πβ¨ππ¦πΈπ
π¦ where this page comes from
- arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND 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