Manual Pages for UNIX Darwin command on man Pod::InputObjects
MyWebUniversity

Manual Pages for UNIX Darwin command on man Pod::InputObjects

Pod::InputObjects(3pm) Perl Programmers Reference Guide Pod::InputObjects(3pm)

NAME

Pod::InputObjects - objects representing POD input paragraphs, com-

mands, etc.

SYNOPSIS

use Pod::InputObjects;

RREEQQUUIIRREESS perl5.004, Carp EEXXPPOORRTTSS Nothing.

DESCRIPTION

This module defines some basic input objects used by PPoodd::::PPaarrsseerr when reading and parsing POD text from an input source. The following objects are defined: package PPoodd::::PPaarraaggrraapphh An object corresponding to a paragraph of POD input text. It may be a plain paragraph, a verbatim paragraph, or a command paragraph (see perlpod). package PPoodd::::IInntteerriioorrSSeeqquueennccee An object corresponding to an interior sequence command from the POD input text (see perlpod). package PPoodd::::PPaarrsseeTTrreeee An object corresponding to a tree of parsed POD text. Each "node"

in a parse-tree (or ptree) is either a text-string or a reference

to a PPoodd::::IInntteerriioorrSSeeqquueennccee object. The nodes appear in the parse-

tree in the order in which they were parsed from left-to-right.

Each of these input objects are described in further detail in the sec-

tions which follow. PPoodd::::PPaarraaggrraapphh

An object representing a paragraph of POD input text. It has the fol-

lowing methods/attributes:

PPoodd::::PPaarraaggrraapphh->>nneeww(())

my $podpara1 = Pod::Paragraph->new(-text => $text);

my $podpara2 = Pod::Paragraph->new(-name => $cmd,

-text => $text);

my $podpara3 = new Pod::Paragraph(-text => $text);

my $podpara4 = new Pod::Paragraph(-name => $cmd,

-text => $text);

my $podpara5 = Pod::Paragraph->new(-name => $cmd,

-text => $text,

-file => $filename,

-line => $linenumber);

This is a class method that constructs a "Pod::Paragraph" object and returns a reference to the new paragraph object. It may be given one or

two keyword arguments. The "-text" keyword indicates the corresponding

text of the POD paragraph. The "-name" keyword indicates the name of

the corresponding POD command, such as "head1" or "item" (it should not

contain the "=" prefix); this is needed only if the POD paragraph cor-

responds to a command paragraph. The "-file" and "-line" keywords indi-

cate the filename and line number corresponding to the beginning of the paragraph

$$ppooddppaarraa->>ccmmddnnaammee(())

my $paracmd = $podpara->cmdname();

If this paragraph is a command paragraph, then this method will return the name of the command (without any leading "=" prefix).

$$ppooddppaarraa->>tteexxtt(())

my $paratext = $podpara->text();

This method will return the corresponding text of the paragraph.

$$ppooddppaarraa->>rraawwtteexxtt(())

my $rawpodpara = $podpara->rawtext();

This method will return the raw text of the POD paragraph, exactly as it appeared in the input.

$$ppooddppaarraa->>ccmmddpprreeffiixx(())

my $prefix = $podpara->cmdprefix();

If this paragraph is a command paragraph, then this method will return the prefix used to denote the command (which should be the string "=" or "==").

$$ppooddppaarraa->>ccmmddsseeppaarraattoorr(())

my $separator = $podpara->cmdseparator();

If this paragraph is a command paragraph, then this method will return

the text used to separate the command name from the rest of the para-

graph (if any).

$$ppooddppaarraa->>ppaarrsseettrreeee(())

my $ptree = $podparser->parsetext( $podpara->text() );

$podpara->parsetree( $ptree );

$ptree = $podpara->parsetree();

This method will get/set the corresponding parse-tree of the para-

graph's text.

$$ppooddppaarraa->>ffiilleelliinnee(())

my ($filename, $linenumber) = $podpara->fileline();

my $position = $podpara->fileline();

Returns the current filename and line number for the paragraph object. If called in a list context, it returns a list of two elements: first the filename, then the line number. If called in a scalar context, it returns a string containing the filename, followed by a colon (':'), followed by the line number. PPoodd::::IInntteerriioorrSSeeqquueennccee An object representing a POD interior sequence command. It has the following methods/attributes:

PPoodd::::IInntteerriioorrSSeeqquueennccee->>nneeww(())

my $podseq1 = Pod::InteriorSequence->new(-name => $cmd

-ldelim => $delimiter);

my $podseq2 = new Pod::InteriorSequence(-name => $cmd,

-ldelim => $delimiter);

my $podseq3 = new Pod::InteriorSequence(-name => $cmd,

-ldelim => $delimiter,

-file => $filename,

-line => $linenumber);

my $podseq4 = new Pod::InteriorSequence(-name => $cmd, $ptree);

my $podseq5 = new Pod::InteriorSequence($cmd, $ptree);

This is a class method that constructs a "Pod::InteriorSequence" object and returns a reference to the new interior sequence object. It should

be given two keyword arguments. The "-ldelim" keyword indicates the

corresponding left-delimiter of the interior sequence (e.g. '<'). The

"-name" keyword indicates the name of the corresponding interior

sequence command, such as "I" or "B" or "C". The "-file" and "-line"

keywords indicate the filename and line number corresponding to the

beginning of the interior sequence. If the $ptree argument is given, it

must be the last argument, and it must be either string, or else an

array-ref suitable for passing to PPoodd::::PPaarrsseeTTrreeee::::nneeww (or it may be a

reference to a Pod::ParseTree object).

$$ppooddsseeqq->>ccmmddnnaammee(())

my $seqcmd = $podseq->cmdname();

The name of the interior sequence command.

$$ppooddsseeqq->>pprreeppeenndd(())

$podseq->prepend($text);

$podseq1->prepend($podseq2);

Prepends the given string or parse-tree or sequence object to the

parse-tree of this interior sequence.

$$ppooddsseeqq->>aappppeenndd(())

$podseq->append($text);

$podseq1->append($podseq2);

Appends the given string or parse-tree or sequence object to the parse-

tree of this interior sequence.

$$ppooddsseeqq->>nneesstteedd(())

$outerseq = $podseq->nested || print "not nested";

If this interior sequence is nested inside of another interior sequence, then the outer/parent sequence that contains it is returned. Otherwise "undef" is returned.

$$ppooddsseeqq->>rraawwtteexxtt(())

my $seqrawtext = $podseq->rawtext();

This method will return the raw text of the POD interior sequence, exactly as it appeared in the input.

$$ppooddsseeqq->>lleeffttddeelliimmiitteerr(())

my $ldelim = $podseq->leftdelimiter();

The leftmost delimiter beginning the argument text to the interior sequence (should be "<").

$$ppooddsseeqq->>rriigghhttddeelliimmiitteerr(())

The rightmost delimiter beginning the argument text to the interior sequence (should be ">").

$$ppooddsseeqq->>ppaarrsseettrreeee(())

my $ptree = $podparser->parsetext($paragraphtext);

$podseq->parsetree( $ptree );

$ptree = $podseq->parsetree();

This method will get/set the corresponding parse-tree of the interior

sequence's text.

$$ppooddsseeqq->>ffiilleelliinnee(())

my ($filename, $linenumber) = $podseq->fileline();

my $position = $podseq->fileline();

Returns the current filename and line number for the interior sequence

object. If called in a list context, it returns a list of two ele-

ments: first the filename, then the line number. If called in a scalar context, it returns a string containing the filename, followed by a colon (':'), followed by the line number. PPoodd::::IInntteerriioorrSSeeqquueennccee::::DDEESSTTRROOYY(())

This method performs any necessary cleanup for the interior-sequence.

If you override this method then it is iimmppeerraattiivvee that you invoke the

parent method from within your own method, otherwise interior-sequence

storage will not be reclaimed upon destruction! PPoodd::::PPaarrsseeTTrreeee This object corresponds to a tree of parsed POD text. As POD text is

scanned from left to right, it is parsed into an ordered list of text-

strings and PPoodd::::IInntteerriioorrSSeeqquueennccee objects (in order of appearance). A PPoodd::::PPaarrsseeTTrreeee object corresponds to this list of strings and

sequences. Each interior sequence in the parse-tree may itself contain

a parse-tree (since interior sequences may be nested).

PPoodd::::PPaarrsseeTTrreeee->>nneeww(())

my $ptree1 = Pod::ParseTree->new;

my $ptree2 = new Pod::ParseTree;

my $ptree4 = Pod::ParseTree->new($arrayref);

my $ptree3 = new Pod::ParseTree($arrayref);

This is a class method that constructs a "Pod::Parsetree" object and

returns a reference to the new parse-tree. If a single-argument is

given, it must be a reference to an array, and is used to initialize the root (top) of the parse tree.

$$ppttrreeee->>ttoopp(())

my $topnode = $ptree->top();

$ptree->top( $topnode );

$ptree->top( @children );

This method gets/sets the top node of the parse-tree. If no arguments

are given, it returns the topmost node in the tree (the root), which is

also a PPoodd::::PPaarrsseeTTrreeee. If it is given a single argument that is a ref-

erence, then the reference is assumed to a parse-tree and becomes the

new top node. Otherwise, if arguments are given, they are treated as the new list of children for the top node.

$$ppttrreeee->>cchhiillddrreenn(())

This method gets/sets the children of the top node in the parse-tree.

If no arguments are given, it returns the list (array) of children (each of which should be either a string or a PPoodd::::IInntteerriioorrSSeeqquueennccee. Otherwise, if arguments are given, they are treated as the new list of children for the top node.

$$ppttrreeee->>pprreeppeenndd(())

This method prepends the given text or parse-tree to the current

parse-tree. If the first item on the parse-tree is text and the argu-

ment is also text, then the text is prepended to the first item (not added as a separate string). Otherwise the argument is added as a new

string or parse-tree before the current one.

$$ppttrreeee->>aappppeenndd(())

This method appends the given text or parse-tree to the current

parse-tree. If the last item on the parse-tree is text and the argu-

ment is also text, then the text is appended to the last item (not added as a separate string). Otherwise the argument is added as a new

string or parse-tree after the current one.

$$ppttrreeee->>rraawwtteexxtt(())

my $ptreerawtext = $ptree->rawtext();

This method will return the raw text of the POD parse-tree exactly as

it appeared in the input. PPoodd::::PPaarrsseeTTrreeee::::DDEESSTTRROOYY(())

This method performs any necessary cleanup for the parse-tree. If you

override this method then it is iimmppeerraattiivvee that you invoke the parent

method from within your own method, otherwise parse-tree storage will

not be reclaimed upon destruction!

SEE ALSO

See Pod::Parser, Pod::Select AUTHOR Please report bugs using . Brad Appleton

perl v5.8.8 2001-09-21 Pod::InputObjects(3pm)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™