Pod::InputObjects - objects representing POD input paragraphs, commands, etc.
- use Pod::InputObjects;
perl5.004, Carp
Nothing.
This module defines some basic input objects used by Pod::Parser when reading and parsing POD text from an input source. The following objects are defined:
An object corresponding to a source of POD input text. It is mostly a
wrapper around a filehandle or C
An object corresponding to a paragraph of POD input text. It may be a
plain paragraph, a verbatim paragraph, or a command paragraph (see
L
An object corresponding to an interior sequence command from the POD
input text (see L
An object corresponding to a tree of parsed POD text. Each "node" in
a parse-tree (or I
Each of these input objects are described in further detail in the sections which follow.
This object corresponds to an input source or stream of POD
documentation. When parsing PODs, it is necessary to associate and store
certain context information with each input source. All of this
information is kept together with the stream itself in one of these
C
This is a class method that constructs a C
- my $filename = $pod_input->name();
- $pod_input->name($new_filename_to_use);
This method gets/sets the name of the input source (usually a filename). If no argument is given, it returns a string containing the name of the input source; otherwise it sets the name of the input source to the contents of the given argument.
- my $handle = $pod_input->handle();
Returns a reference to the handle object from which input is read (the one used to contructed this input source object).
- print "Yes.\n" if ($pod_input->was_cutting());
The value of the C
An object representing a paragraph of POD input text. It has the following methods/attributes:
- my $pod_para1 = Pod::Paragraph->new(-text => $text);
- my $pod_para2 = Pod::Paragraph->new(-name => $cmd,
- -text => $text);
- my $pod_para3 = new Pod::Paragraph(-text => $text);
- my $pod_para4 = new Pod::Paragraph(-name => $cmd,
- -text => $text);
- my $pod_para5 = Pod::Paragraph->new(-name => $cmd,
- -text => $text,
- -file => $filename,
- -line => $line_number);
This is a class method that constructs a C
- my $para_cmd = $pod_para->cmd_name();
If this paragraph is a command paragraph, then this method will return
the name of the command (I
- my $para_text = $pod_para->text();
This method will return the corresponding text of the paragraph.
- my $raw_pod_para = $pod_para->raw_text();
This method will return the I
- my $prefix = $pod_para->cmd_prefix();
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 "==").
- my $separator = $pod_para->cmd_separator();
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 paragraph (if any).
- my $ptree = $pod_parser->parse_text( $pod_para->text() );
- $pod_para->parse_tree( $ptree );
- $ptree = $pod_para->parse_tree();
This method will get/set the corresponding parse-tree of the paragraph's text.
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.
An object representing a POD interior sequence command. It has the following methods/attributes:
- my $pod_seq1 = Pod::InteriorSequence->new(-name => $cmd
- -ldelim => $delimiter);
- my $pod_seq2 = new Pod::InteriorSequence(-name => $cmd,
- -ldelim => $delimiter);
- my $pod_seq3 = new Pod::InteriorSequence(-name => $cmd,
- -ldelim => $delimiter,
- -file => $filename,
- -line => $line_number);
- my $pod_seq4 = new Pod::InteriorSequence(-name => $cmd, $ptree);
- my $pod_seq5 = new Pod::InteriorSequence($cmd, $ptree);
This is a class method that constructs a C
- my $seq_cmd = $pod_seq->cmd_name();
The name of the interior sequence command.
- $pod_seq->prepend($text);
- $pod_seq1->prepend($pod_seq2);
Prepends the given string or parse-tree or sequence object to the parse-tree of this interior sequence.
- $pod_seq->append($text);
- $pod_seq1->append($pod_seq2);
Appends the given string or parse-tree or sequence object to the parse-tree of this interior sequence.
- $outer_seq = $pod_seq->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 C
- my $seq_raw_text = $pod_seq->raw_text();
This method will return the I
- my $ldelim = $pod_seq->left_delimiter();
The leftmost delimiter beginning the argument text to the interior sequence (should be "<").
The rightmost delimiter beginning the argument text to the interior sequence (should be ">").
- my $ptree = $pod_parser->parse_text($paragraph_text);
- $pod_seq->parse_tree( $ptree );
- $ptree = $pod_seq->parse_tree();
This method will get/set the corresponding parse-tree of the interior sequence's text.
Returns the current filename and line number for the interior sequence 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.
This method performs any necessary cleanup for the interior-sequence.
If you override this method then it is B
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 B
This is a class method that constructs a C
- my $top_node = $ptree->top();
- $ptree->top( $top_node );
- $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 B
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 B
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 argument 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 I
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 argument 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 I
- my $ptree_raw_text = $ptree->raw_text();
This method will return the I
This method performs any necessary cleanup for the parse-tree.
If you override this method then it is B
See L
Please report bugs using L
Brad Appleton E