NAME
Pod::Simple - framework for parsing Pod
SYNOPSIS
TODODESCRIPTION
Pod::Simple is a Perl library for parsing text in the Pod ("plain old
documentation") markup language that is typically used for writing documentation for Perl and for Perl modules. The Pod format is explained in the perlpod man page; the most common formatter is called "perldoc".Pod formatters can use Pod::Simple to parse Pod documents into produce
renderings of them in plain ASCII, in HTML, or in any number of otherformats. Typically, such formatters will be subclasses of Pod::Simple,
and so they will inherit its methods, like "parsefile".If you're reading this document just because you have a Pod-processing
subclass that you want to use, this document (plus the documentation for the subclass) is probably all you'll need to read. If you're reading this document because you want to write a formatter subclass, continue reading this document, and then readPod::Simple::Subclassing, and then possibly even read perlpodspec (some
of which is for parser-writers, but much of which is notes to
formatter-writers).
MMAAIINN MMEETTHHOODDSS"$parser = SomeClass->new();"
This returns a new parser object, where "SomeClass" is a subclassof Pod::Simple.
"$parser->outputfh( *OUT );"
This sets the filehandle that $parser's output will be written to.
You can pass *STDOUT, otherwise you should probably do something like this:my $outfile = "output.txt";
open TXTOUT, ">$outfile" or die "Can't write to $outfile: $!";
$parser->outputfh(*TXTOUT);
...before you call one of the "$parser->parsewhatever" methods.
"$parser->outputstring( \$somestring );"
This sets the string that $parser's output will be sent to, instead
of any filehandle."$parser->parsefile( $somefilename );"
"$parser->parsefile( *INPUTFH );"
This reads the Pod content of the file (or filehandle) that youspecify, and processes it with that $parser object, according to
however $parser's class works, and according to whatever parser
options you have set up for this $parser object.
"$parser->parsestringdocument( $allcontent );"
This works just like "parsefile" except that it reads the Pod content not from a file, but from a string that you have already in memory."$parser->parselines( ...@lines..., undef );"
This processes the lines in @lines (where each list item must be adefined value, and must contain exactly one line of content - so
no items like "foo\nbar" are allowed). The final "undef" is used to indicate the end of document being parsed. The other "parserwhatever" methods are meant to be called onlyonce per $parser object; but "parselines" can be called as many
times per $parser object as you want, as long as the last call (and
only the last call) ends with an "undef" value."$parser->contentseen"
This returns true only if there has been any real content seen for this document."SomeClass->filter( $filename );"
"SomeClass->filter( *INPUTFH );"
"SomeClass->filter( \$documentcontent );"
This is a shortcut method for creating a new parser object, setting the output handle to STDOUT, and then processing the specified file(or filehandle, or in-memory document). This is handy for one-
liners like this:perl -MPod::Simple::Text -e "Pod::Simple::Text->filter('thingy.pod')"
SSEECCOONNDDAARRYY MMEETTHHOODDSS Some of these methods might be of interest to general users, as well asof interest to formatter-writers.
Note that the general pattern here is that the accessor-methods read
the attribute's value with "$value = $parser->attribute" and set the
attribute's value with "$parser->attribute(newvalue)". For each
accessor, I typically only mention one syntax or another, based on which I think you are actually most likely to use."$parser->nowhining( SOMEVALUE )"
If you set this attribute to a true value, you will suppress the parser's complaints about irregularities in the Pod coding. By default, this attribute's value is false, meaning that irregularities will be reported. Note that turning this attribute to true won't suppress one or two kinds of complaints about rarely occurring unrecoverable errors."$parser->noerratasection( SOMEVALUE )"
If you set this attribute to a true value, you will stop the parserfrom generating a "POD ERRORS" section at the end of the document.
By default, this attribute's value is false, meaning that an errata section will be generated, as necessary."$parser->complainstderr( SOMEVALUE )"
If you set this attribute to a true value, it will send reports of parsing errors to STDERR. By default, this attribute's value is false, meaning that no output is sent to STDERR. Note that errors can be noted in an errata section, or sent to STDERR, or both, or neither. So don't think that turning on "complainstderr" will turn off "noerratasection" or vice versa- these are independent attributes.
"$parser->sourcefilename"
This returns the filename that this parser object was set to read from."$parser->dochasstarted"
This returns true if $parser has read from a source, and has seen
Pod content in it."$parser->sourcedead"
This returns true if $parser has read from a source, and come to
the end of that source. CCAAVVEEAATTSSThis is just a beta release - there are a good number of things still
left to do. Notably, support for EBCDIC platforms is still half-done,
an untested.SEE ALSO
Pod::Simple::Subclassing
perlpod perlpodspec Pod::Escapes perldoc COPYRIGHT AND DISCLAIMERS Copyright (c) 2002 Sean M. Burke. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. AUTHOR Original author: Sean M. Burke "sburke@cpan.org" Maintained by: Allison Randal "allison@perl.org"perl v5.8.8 2006-07-07 Pod::Simple(3)