Parse::Man::DOM - parse nroff-formatted manpages and return a DOM tree
Parse::Man::DOM
use Parse::Man::DOM; my $parser = Parse::Man::DOM->new; my $document = $parser->from_file( "my_manpage.1" ); print "The manpage name is", $document->meta( "name" ), "\n";
This subclass of Parse::Man returns an object tree representing the parsed content of the input file. The returned result will be an object of the Parse::Man::DOM::Document class, which itself will contain other objects nested within it.
Parse::Man::DOM::Document
Represents the document as a whole.
Returns a Parse::Man::DOM::Metadata object for the named item of metadata.
Parse::Man::DOM::Metadata
name
The page name given to the .TH directive.
.TH
section
The section number given to the .TH directive.
Returns a list of Parse::Man::DOM::Heading or Parse::Man::DOM::Para or subclass objects, containing the actual page content.
Parse::Man::DOM::Heading
Parse::Man::DOM::Para
Represents a single item of metadata about the page.
The string name of the metadata
The string value of the metadata
Represents the contents of a .SH or .SS heading
.SH
.SS
The heading level number; 1 for .SH, 2 for .SS
The plain text string of the heading title
Represents a paragraph of formatted text content. Will be one of the following subclasses.
Returns true if filling (.fi) is in effect, or false if no-filling (.nf) is in effect.
.fi
.nf
Returns a Parse::Man::DOM::Chunklist to represent the actual content of the paragraph.
Parse::Man::DOM::Chunklist
Represent a plain (.P or .PP) paragraph.
.P
.PP
Returns "plain".
"plain"
Represents a term paragraph (.TP).
.TP
Returns "term".
"term"
Returns a Parse::Man::DOM::Chunklist for the defined term name.
Returns a Parse::Man::DOM::Chunklist for the defined term definition.
Represents an indented paragraph (.IP).
.IP
Returns "indent".
"indent"
Contains a list of Parse::Man::DOM::Chunk objects to represent paragraph content.
Parse::Man::DOM::Chunk
Returns a list of Parse::Man::DOM::Chunk objects.
Represents a chunk of text with a particular format applied.
The plain string value of the text for this chunk.
The font name in effect for this chunk. One of "R", "B", "I" or "SM".
"R"
"B"
"I"
"SM"
The size of this chunk, relative to the paragraph base of 0.
Paul Evans <leonerd@leonerd.org.uk>
To install Parse::Man, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Parse::Man
CPAN shell
perl -MCPAN -e shell install Parse::Man
For more information on module installation, please visit the detailed CPAN module installation guide.