2 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns=
"http://www.w3.org/1999/xhtml">
5 <title>Pod::InputObjects - objects representing POD input paragraphs, commands, etc.
</title>
6 <meta http-equiv=
"content-type" content=
"text/html; charset=utf-8" />
7 <link rev=
"made" href=
"mailto:" />
10 <body style=
"background-color: white">
11 <table border=
"0" width=
"100%" cellspacing=
"0" cellpadding=
"3">
12 <tr><td class=
"block" style=
"background-color: #cccccc" valign=
"middle">
13 <big><strong><span class=
"block"> Pod::InputObjects - objects representing POD input paragraphs, commands, etc.
</span></strong></big>
17 <p><a name=
"__index__"></a></p>
22 <li><a href=
"#name">NAME
</a></li>
23 <li><a href=
"#synopsis">SYNOPSIS
</a></li>
24 <li><a href=
"#requires">REQUIRES
</a></li>
25 <li><a href=
"#exports">EXPORTS
</a></li>
26 <li><a href=
"#description">DESCRIPTION
</a></li>
27 <li><a href=
"#pod__inputsource"><strong>Pod::InputSource
</strong></a></li>
30 <li><a href=
"#new__"><strong>new()
</strong></a></li>
31 <li><a href=
"#name__"><strong>name()
</strong></a></li>
32 <li><a href=
"#handle__"><strong>handle()
</strong></a></li>
33 <li><a href=
"#was_cutting__"><strong>was_cutting()
</strong></a></li>
36 <li><a href=
"#pod__paragraph"><strong>Pod::Paragraph
</strong></a></li>
39 <li><a href=
"#pod__paragraph_new__">Pod::Paragraph-
><strong>new()
</strong></a></li>
40 <li><a href=
"#_pod_para_cmd_name__">$pod_para-
><strong>cmd_name()
</strong></a></li>
41 <li><a href=
"#_pod_para_text__">$pod_para-
><strong>text()
</strong></a></li>
42 <li><a href=
"#_pod_para_raw_text__">$pod_para-
><strong>raw_text()
</strong></a></li>
43 <li><a href=
"#_pod_para_cmd_prefix__">$pod_para-
><strong>cmd_prefix()
</strong></a></li>
44 <li><a href=
"#_pod_para_cmd_separator__">$pod_para-
><strong>cmd_separator()
</strong></a></li>
45 <li><a href=
"#_pod_para_parse_tree__">$pod_para-
><strong>parse_tree()
</strong></a></li>
46 <li><a href=
"#_pod_para_file_line__">$pod_para-
><strong>file_line()
</strong></a></li>
49 <li><a href=
"#pod__interiorsequence"><strong>Pod::InteriorSequence
</strong></a></li>
52 <li><a href=
"#pod__interiorsequence_new__">Pod::InteriorSequence-
><strong>new()
</strong></a></li>
53 <li><a href=
"#_pod_seq_cmd_name__">$pod_seq-
><strong>cmd_name()
</strong></a></li>
54 <li><a href=
"#_pod_seq_prepend__">$pod_seq-
><strong>prepend()
</strong></a></li>
55 <li><a href=
"#_pod_seq_append__">$pod_seq-
><strong>append()
</strong></a></li>
56 <li><a href=
"#_pod_seq_nested__">$pod_seq-
><strong>nested()
</strong></a></li>
57 <li><a href=
"#_pod_seq_raw_text__">$pod_seq-
><strong>raw_text()
</strong></a></li>
58 <li><a href=
"#_pod_seq_left_delimiter__">$pod_seq-
><strong>left_delimiter()
</strong></a></li>
59 <li><a href=
"#_pod_seq_right_delimiter__">$pod_seq-
><strong>right_delimiter()
</strong></a></li>
60 <li><a href=
"#_pod_seq_parse_tree__">$pod_seq-
><strong>parse_tree()
</strong></a></li>
61 <li><a href=
"#_pod_seq_file_line__">$pod_seq-
><strong>file_line()
</strong></a></li>
62 <li><a href=
"#pod__interiorsequence__destroy__">Pod::InteriorSequence::
<strong>DESTROY()
</strong></a></li>
65 <li><a href=
"#pod__parsetree"><strong>Pod::ParseTree
</strong></a></li>
68 <li><a href=
"#pod__parsetree_new__">Pod::ParseTree-
><strong>new()
</strong></a></li>
69 <li><a href=
"#_ptree_top__">$ptree-
><strong>top()
</strong></a></li>
70 <li><a href=
"#_ptree_children__">$ptree-
><strong>children()
</strong></a></li>
71 <li><a href=
"#_ptree_prepend__">$ptree-
><strong>prepend()
</strong></a></li>
72 <li><a href=
"#_ptree_append__">$ptree-
><strong>append()
</strong></a></li>
73 <li><a href=
"#_ptree_raw_text__">$ptree-
><strong>raw_text()
</strong></a></li>
74 <li><a href=
"#pod__parsetree__destroy__">Pod::ParseTree::
<strong>DESTROY()
</strong></a></li>
77 <li><a href=
"#see_also">SEE ALSO
</a></li>
78 <li><a href=
"#author">AUTHOR
</a></li>
85 <h1><a name=
"name">NAME
</a></h1>
86 <p>Pod::InputObjects - objects representing POD input paragraphs, commands, etc.
</p>
90 <h1><a name=
"synopsis">SYNOPSIS
</a></h1>
92 use Pod::InputObjects;
</pre>
96 <h1><a name=
"requires">REQUIRES
</a></h1>
97 <p>perl5.004, Carp
</p>
101 <h1><a name=
"exports">EXPORTS
</a></h1>
106 <h1><a name=
"description">DESCRIPTION
</a></h1>
107 <p>This module defines some basic input objects used by
<strong>Pod::Parser
</strong> when
108 reading and parsing POD text from an input source. The following objects
111 <dt><strong><a name=
"item_package_pod_3a_3aparagraph">package
<strong>Pod::Paragraph
</strong></a></strong>
114 <p>An object corresponding to a paragraph of POD input text. It may be a
115 plain paragraph, a verbatim paragraph, or a command paragraph (see
116 <a href=
"file://C|\msysgit\mingw\html/pod/perlpod.html">the perlpod manpage
</a>).
</p>
119 <dt><strong><a name=
"item_package_pod_3a_3ainteriorsequence">package
<strong>Pod::InteriorSequence
</strong></a></strong>
122 <p>An object corresponding to an interior sequence command from the POD
123 input text (see
<a href=
"file://C|\msysgit\mingw\html/pod/perlpod.html">the perlpod manpage
</a>).
</p>
126 <dt><strong><a name=
"item_package_pod_3a_3aparsetree">package
<strong>Pod::ParseTree
</strong></a></strong>
129 <p>An object corresponding to a tree of parsed POD text. Each ``node'' in
130 a parse-tree (or
<em>ptree
</em>) is either a text-string or a reference to
131 a
<strong>Pod::InteriorSequence
</strong> object. The nodes appear in the parse-tree
132 in the order in which they were parsed from left-to-right.
</p>
136 <p>Each of these input objects are described in further detail in the
137 sections which follow.
</p>
141 <h1><a name=
"pod__paragraph"><strong>Pod::Paragraph
</strong></a></h1>
142 <p>An object representing a paragraph of POD input text.
143 It has the following methods/attributes:
</p>
146 <h2><a name=
"pod__paragraph_new__">Pod::Paragraph-
><strong>new()
</strong></a></h2>
148 my $pod_para1 = Pod::Paragraph-
>new(-text =
> $text);
149 my $pod_para2 = Pod::Paragraph-
>new(-name =
> $cmd,
151 my $pod_para3 = new Pod::Paragraph(-text =
> $text);
152 my $pod_para4 = new Pod::Paragraph(-name =
> $cmd,
154 my $pod_para5 = Pod::Paragraph-
>new(-name =
> $cmd,
156 -file =
> $filename,
157 -line =
> $line_number);
</pre>
158 <p>This is a class method that constructs a
<code>Pod::Paragraph
</code> object and
159 returns a reference to the new paragraph object. It may be given one or
160 two keyword arguments. The
<code>-text
</code> keyword indicates the corresponding
161 text of the POD paragraph. The
<code>-name
</code> keyword indicates the name of
162 the corresponding POD command, such as
<code>head1
</code> or
<code>item
</code> (it should
163 <em>not
</em> contain the
<code>=
</code> prefix); this is needed only if the POD
164 paragraph corresponds to a command paragraph. The
<code>-file
</code> and
<code>-line
</code>
165 keywords indicate the filename and line number corresponding to the
166 beginning of the paragraph
</p>
169 <h2><a name=
"_pod_para_cmd_name__">$pod_para-
><strong>cmd_name()
</strong></a></h2>
171 my $para_cmd = $pod_para-
>cmd_name();
</pre>
172 <p>If this paragraph is a command paragraph, then this method will return
173 the name of the command (
<em>without
</em> any leading
<code>=
</code> prefix).
</p>
176 <h2><a name=
"_pod_para_text__">$pod_para-
><strong>text()
</strong></a></h2>
178 my $para_text = $pod_para-
>text();
</pre>
179 <p>This method will return the corresponding text of the paragraph.
</p>
182 <h2><a name=
"_pod_para_raw_text__">$pod_para-
><strong>raw_text()
</strong></a></h2>
184 my $raw_pod_para = $pod_para-
>raw_text();
</pre>
185 <p>This method will return the
<em>raw
</em> text of the POD paragraph, exactly
186 as it appeared in the input.
</p>
189 <h2><a name=
"_pod_para_cmd_prefix__">$pod_para-
><strong>cmd_prefix()
</strong></a></h2>
191 my $prefix = $pod_para-
>cmd_prefix();
</pre>
192 <p>If this paragraph is a command paragraph, then this method will return
193 the prefix used to denote the command (which should be the string ``=''
197 <h2><a name=
"_pod_para_cmd_separator__">$pod_para-
><strong>cmd_separator()
</strong></a></h2>
199 my $separator = $pod_para-
>cmd_separator();
</pre>
200 <p>If this paragraph is a command paragraph, then this method will return
201 the text used to separate the command name from the rest of the
202 paragraph (if any).
</p>
205 <h2><a name=
"_pod_para_parse_tree__">$pod_para-
><strong>parse_tree()
</strong></a></h2>
207 my $ptree = $pod_parser-
>parse_text( $pod_para-
>text() );
208 $pod_para-
>parse_tree( $ptree );
209 $ptree = $pod_para-
>parse_tree();
</pre>
210 <p>This method will get/set the corresponding parse-tree of the paragraph's text.
</p>
213 <h2><a name=
"_pod_para_file_line__">$pod_para-
><strong>file_line()
</strong></a></h2>
215 my ($filename, $line_number) = $pod_para-
>file_line();
216 my $position = $pod_para-
>file_line();
</pre>
217 <p>Returns the current filename and line number for the paragraph
218 object. If called in a list context, it returns a list of two
219 elements: first the filename, then the line number. If called in
220 a scalar context, it returns a string containing the filename, followed
221 by a colon (':'), followed by the line number.
</p>
225 <h1><a name=
"pod__interiorsequence"><strong>Pod::InteriorSequence
</strong></a></h1>
226 <p>An object representing a POD interior sequence command.
227 It has the following methods/attributes:
</p>
230 <h2><a name=
"pod__interiorsequence_new__">Pod::InteriorSequence-
><strong>new()
</strong></a></h2>
232 my $pod_seq1 = Pod::InteriorSequence-
>new(-name =
> $cmd
233 -ldelim =
> $delimiter);
234 my $pod_seq2 = new Pod::InteriorSequence(-name =
> $cmd,
235 -ldelim =
> $delimiter);
236 my $pod_seq3 = new Pod::InteriorSequence(-name =
> $cmd,
237 -ldelim =
> $delimiter,
238 -file =
> $filename,
239 -line =
> $line_number);
</pre>
241 my $pod_seq4 = new Pod::InteriorSequence(-name =
> $cmd, $ptree);
242 my $pod_seq5 = new Pod::InteriorSequence($cmd, $ptree);
</pre>
243 <p>This is a class method that constructs a
<code>Pod::InteriorSequence
</code> object
244 and returns a reference to the new interior sequence object. It should
245 be given two keyword arguments. The
<code>-ldelim
</code> keyword indicates the
246 corresponding left-delimiter of the interior sequence (e.g. '
<').
247 The
<code>-name
</code> keyword indicates the name of the corresponding interior
248 sequence command, such as
<code>I
</code> or
<code>B
</code> or
<code>C
</code>. The
<code>-file
</code> and
249 <code>-line
</code> keywords indicate the filename and line number corresponding
250 to the beginning of the interior sequence. If the
<code>$ptree
</code> argument is
251 given, it must be the last argument, and it must be either string, or
252 else an array-ref suitable for passing to
<strong>Pod::ParseTree::new
</strong> (or
253 it may be a reference to a Pod::ParseTree object).
</p>
256 <h2><a name=
"_pod_seq_cmd_name__">$pod_seq-
><strong>cmd_name()
</strong></a></h2>
258 my $seq_cmd = $pod_seq-
>cmd_name();
</pre>
259 <p>The name of the interior sequence command.
</p>
262 <h2><a name=
"_pod_seq_prepend__">$pod_seq-
><strong>prepend()
</strong></a></h2>
264 $pod_seq-
>prepend($text);
265 $pod_seq1-
>prepend($pod_seq2);
</pre>
266 <p>Prepends the given string or parse-tree or sequence object to the parse-tree
267 of this interior sequence.
</p>
270 <h2><a name=
"_pod_seq_append__">$pod_seq-
><strong>append()
</strong></a></h2>
272 $pod_seq-
>append($text);
273 $pod_seq1-
>append($pod_seq2);
</pre>
274 <p>Appends the given string or parse-tree or sequence object to the parse-tree
275 of this interior sequence.
</p>
278 <h2><a name=
"_pod_seq_nested__">$pod_seq-
><strong>nested()
</strong></a></h2>
280 $outer_seq = $pod_seq-
>nested || print
"not nested
";
</pre>
281 <p>If this interior sequence is nested inside of another interior
282 sequence, then the outer/parent sequence that contains it is
283 returned. Otherwise
<a href=
"file://C|\msysgit\mingw\html/pod/perlfunc.html#item_undef"><code>undef
</code></a> is returned.
</p>
286 <h2><a name=
"_pod_seq_raw_text__">$pod_seq-
><strong>raw_text()
</strong></a></h2>
288 my $seq_raw_text = $pod_seq-
>raw_text();
</pre>
289 <p>This method will return the
<em>raw
</em> text of the POD interior sequence,
290 exactly as it appeared in the input.
</p>
293 <h2><a name=
"_pod_seq_left_delimiter__">$pod_seq-
><strong>left_delimiter()
</strong></a></h2>
295 my $ldelim = $pod_seq-
>left_delimiter();
</pre>
296 <p>The leftmost delimiter beginning the argument text to the interior
297 sequence (should be ``
<'').
</p>
300 <h2><a name=
"_pod_seq_right_delimiter__">$pod_seq-
><strong>right_delimiter()
</strong></a></h2>
301 <p>The rightmost delimiter beginning the argument text to the interior
302 sequence (should be ``
>'').
</p>
305 <h2><a name=
"_pod_seq_parse_tree__">$pod_seq-
><strong>parse_tree()
</strong></a></h2>
307 my $ptree = $pod_parser-
>parse_text($paragraph_text);
308 $pod_seq-
>parse_tree( $ptree );
309 $ptree = $pod_seq-
>parse_tree();
</pre>
310 <p>This method will get/set the corresponding parse-tree of the interior
314 <h2><a name=
"_pod_seq_file_line__">$pod_seq-
><strong>file_line()
</strong></a></h2>
316 my ($filename, $line_number) = $pod_seq-
>file_line();
317 my $position = $pod_seq-
>file_line();
</pre>
318 <p>Returns the current filename and line number for the interior sequence
319 object. If called in a list context, it returns a list of two
320 elements: first the filename, then the line number. If called in
321 a scalar context, it returns a string containing the filename, followed
322 by a colon (':'), followed by the line number.
</p>
325 <h2><a name=
"pod__interiorsequence__destroy__">Pod::InteriorSequence::
<strong>DESTROY()
</strong></a></h2>
326 <p>This method performs any necessary cleanup for the interior-sequence.
327 If you override this method then it is
<strong>imperative
</strong> that you invoke
328 the parent method from within your own method, otherwise
329 <em>interior-sequence storage will not be reclaimed upon destruction!
</em></p>
333 <h1><a name=
"pod__parsetree"><strong>Pod::ParseTree
</strong></a></h1>
334 <p>This object corresponds to a tree of parsed POD text. As POD text is
335 scanned from left to right, it is parsed into an ordered list of
336 text-strings and
<strong>Pod::InteriorSequence
</strong> objects (in order of
337 appearance). A
<strong>Pod::ParseTree
</strong> object corresponds to this list of
338 strings and sequences. Each interior sequence in the parse-tree may
339 itself contain a parse-tree (since interior sequences may be nested).
</p>
342 <h2><a name=
"pod__parsetree_new__">Pod::ParseTree-
><strong>new()
</strong></a></h2>
344 my $ptree1 = Pod::ParseTree-
>new;
345 my $ptree2 = new Pod::ParseTree;
346 my $ptree4 = Pod::ParseTree-
>new($array_ref);
347 my $ptree3 = new Pod::ParseTree($array_ref);
</pre>
348 <p>This is a class method that constructs a
<code>Pod::Parse_tree
</code> object and
349 returns a reference to the new parse-tree. If a single-argument is given,
350 it must be a reference to an array, and is used to initialize the root
351 (top) of the parse tree.
</p>
354 <h2><a name=
"_ptree_top__">$ptree-
><strong>top()
</strong></a></h2>
356 my $top_node = $ptree-
>top();
357 $ptree-
>top( $top_node );
358 $ptree-
>top( @children );
</pre>
359 <p>This method gets/sets the top node of the parse-tree. If no arguments are
360 given, it returns the topmost node in the tree (the root), which is also
361 a
<strong>Pod::ParseTree
</strong>. If it is given a single argument that is a reference,
362 then the reference is assumed to a parse-tree and becomes the new top node.
363 Otherwise, if arguments are given, they are treated as the new list of
364 children for the top node.
</p>
367 <h2><a name=
"_ptree_children__">$ptree-
><strong>children()
</strong></a></h2>
368 <p>This method gets/sets the children of the top node in the parse-tree.
369 If no arguments are given, it returns the list (array) of children
370 (each of which should be either a string or a
<strong>Pod::InteriorSequence
</strong>.
371 Otherwise, if arguments are given, they are treated as the new list of
372 children for the top node.
</p>
375 <h2><a name=
"_ptree_prepend__">$ptree-
><strong>prepend()
</strong></a></h2>
376 <p>This method prepends the given text or parse-tree to the current parse-tree.
377 If the first item on the parse-tree is text and the argument is also text,
378 then the text is prepended to the first item (not added as a separate string).
379 Otherwise the argument is added as a new string or parse-tree
<em>before
</em>
383 <h2><a name=
"_ptree_append__">$ptree-
><strong>append()
</strong></a></h2>
384 <p>This method appends the given text or parse-tree to the current parse-tree.
385 If the last item on the parse-tree is text and the argument is also text,
386 then the text is appended to the last item (not added as a separate string).
387 Otherwise the argument is added as a new string or parse-tree
<em>after
</em>
391 <h2><a name=
"_ptree_raw_text__">$ptree-
><strong>raw_text()
</strong></a></h2>
393 my $ptree_raw_text = $ptree-
>raw_text();
</pre>
394 <p>This method will return the
<em>raw
</em> text of the POD parse-tree
395 exactly as it appeared in the input.
</p>
398 <h2><a name=
"pod__parsetree__destroy__">Pod::ParseTree::
<strong>DESTROY()
</strong></a></h2>
399 <p>This method performs any necessary cleanup for the parse-tree.
400 If you override this method then it is
<strong>imperative
</strong>
401 that you invoke the parent method from within your own method,
402 otherwise
<em>parse-tree storage will not be reclaimed upon destruction!
</em></p>
406 <h1><a name=
"see_also">SEE ALSO
</a></h1>
407 <p>See
<a href=
"file://C|\msysgit\mingw\html/lib/Pod/Parser.html">the Pod::Parser manpage
</a>,
<a href=
"file://C|\msysgit\mingw\html/lib/Pod/Select.html">the Pod::Select manpage
</a></p>
411 <h1><a name=
"author">AUTHOR
</a></h1>
412 <p>Please report bugs using
<a href=
"http://rt.cpan.org">http://rt.cpan.org
</a>.
</p>
413 <p>Brad Appleton
<<a href=
"mailto:bradapp@enteract.com">bradapp@enteract.com
</a>></p>
414 <table border=
"0" width=
"100%" cellspacing=
"0" cellpadding=
"3">
415 <tr><td class=
"block" style=
"background-color: #cccccc" valign=
"middle">
416 <big><strong><span class=
"block"> Pod::InputObjects - objects representing POD input paragraphs, commands, etc.
</span></strong></big>