MAN page from Fedora 18 perl-Pod-Parser-1.51-235.fc18.noarch.rpm
Section: Perl Programmers Reference Guide (3pm)
Pod::PlainText - Convert POD data to formatted ASCII text
use Pod::PlainText; my $parser = Pod::PlainText->new (sentence => 0, 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 ('file.pod', 'file.txt');
Pod::PlainText is a module that can convert documentation in the POD
format (thepreferred language for documenting Perl) into formatted ASCII
. It uses nospecial formatting controls or codes whatsoever, and its output is thereforesuitable for nearly any device.
As a derived class from Pod::Parser, Pod::PlainText supports the same methods andinterfaces. See Pod::Parser for all the details; briefly, one creates anew parser with "Pod::PlainText->new()" and then calls eitherparse_from_filehandle() or parse_from_file().
new() can take options, in the form of key/value pairs, that control thebehavior of the parser. The currently recognized options are:
- If set to a true value, selects an alternate output format that, among otherthings, uses a different heading style and marks "=item" entries with acolon in the left margin. Defaults to false.
- The number of spaces to indent regular text, and the default indentation for"=over" blocks. Defaults to 4.
- If set to a true value, a blank line is printed after a "=headN" headings.If set to false (the default), no blank line is printed after "=headN".This is the default because it's the expected formatting for manual pages;if you're formatting arbitrary text documents, setting this to true mayresult in more pleasing output.
- If set to a true value, Pod::PlainText will assume that each sentence ends in twospaces, and will try to preserve that spacing. If set to false, allconsecutive whitespace in non-verbatim paragraphs is compressed into asingle space. Defaults to true.
- The column at which to wrap text on the right-hand side. Defaults to 76.
The standard Pod::Parser method parse_from_filehandle() takes up to twoarguments, the first being the file handle to read POD from and the secondbeing the file handle to write the formatted output to. The first defaultsto STDIN if not given, and the second defaults to STDOUT. The methodparse_from_file() is almost identical, except that its two arguments are theinput and output disk files instead. See Pod::Parser for the specificdetails.
- Bizarre space in item
- (W) Something has gone wrong in internal "=item" processing. This messageindicates a bug in Pod::PlainText; you should never see it.
- Can't open %s for reading: %s
- (F) Pod::PlainText was invoked via the compatibility mode pod2text() interfaceand the input file it was given could not be opened.
- Unknown escape: %s
- (W) The POD source contained an "E<>" escape that Pod::PlainText didn'tknow about.
- Unknown sequence: %s
- (W) The POD source contained a non-standard internal sequence (something ofthe form "X<>") that Pod::PlainText didn't know about.
- Unmatched =back
- (W) Pod::PlainText encountered a "=back" command that didn't correspond to an"=over" command.
Embedded Ctrl-As (octal 001) in the input will be mapped to spaces onoutput, due to an internal implementation detail.
This is a replacement for an earlier Pod::Text module written by TomChristiansen. It has a revamped interface, since it now uses Pod::Parser,but an interface roughly compatible with the old Pod::Text::pod2text()
function is still available. Please change to the new calling convention,though.
The original Pod::Text contained code to do formatting via termcapsequences, although it wasn't turned on by default and it was problematic toget it to work at all. This rewrite doesn't even try to do that, but asubclass of it does. Look for Pod::Text::Termcap.
is part of the Pod::Parser distribution.
Please report bugs using <http://rt.cpan.org
Russ Allbery <rraAATTstanford.edu>, based very heavily on theoriginal Pod::Text by Tom Christiansen <tchristAATTmox.perl.com> andits conversion to Pod::Parser by Brad Appleton<bradappAATTenteract.com>.
- SEE ALSO
This document was created byman2html,using the manual pages.