Edit D:\app\Administrator\product\11.2.0\dbhome_1\perl\html\lib\Pod\Simple\PullParser.html
<?xml version="1.0" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Pod::Simple::PullParser -- a pull-parser interface to parsing Pod</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rev="made" href="mailto:" /> </head> <body style="background-color: white"> <table border="0" width="100%" cellspacing="0" cellpadding="3"> <tr><td class="block" style="background-color: #cccccc" valign="middle"> <big><strong><span class="block"> Pod::Simple::PullParser -- a pull-parser interface to parsing Pod</span></strong></big> </td></tr> </table> <!-- INDEX BEGIN --> <div name="index"> <p><a name="__index__"></a></p> <ul> <li><a href="#name">NAME</a></li> <li><a href="#synopsis">SYNOPSIS</a></li> <li><a href="#description">DESCRIPTION</a></li> <li><a href="#methods">METHODS</a></li> <li><a href="#note">NOTE</a></li> <li><a href="#see_also">SEE ALSO</a></li> <li><a href="#copyright_and_disclaimers">COPYRIGHT AND DISCLAIMERS</a></li> <li><a href="#author">AUTHOR</a></li> </ul> <hr name="index" /> </div> <!-- INDEX END --> <p> </p> <h1><a name="name">NAME</a></h1> <p>Pod::Simple::PullParser -- a pull-parser interface to parsing Pod</p> <p> </p> <hr /> <h1><a name="synopsis">SYNOPSIS</a></h1> <pre> my $parser = SomePodProcessor->new; $parser->set_source( "whatever.pod" ); $parser->run;</pre> <p>Or:</p> <pre> my $parser = SomePodProcessor->new; $parser->set_source( $some_filehandle_object ); $parser->run;</pre> <p>Or:</p> <pre> my $parser = SomePodProcessor->new; $parser->set_source( \$document_source ); $parser->run;</pre> <p>Or:</p> <pre> my $parser = SomePodProcessor->new; $parser->set_source( \@document_lines ); $parser->run;</pre> <p>And elsewhere:</p> <pre> require 5; package SomePodProcessor; use strict; use base qw(Pod::Simple::PullParser); sub run { my $self = shift; Token: while(my $token = $self->get_token) { ...process each token... } }</pre> <p> </p> <hr /> <h1><a name="description">DESCRIPTION</a></h1> <p>This class is for using Pod::Simple to build a Pod processor -- but one that uses an interface based on a stream of token objects, instead of based on events.</p> <p>This is a subclass of <a href="file://C|\ADE\aime_smenon_perl_090715\perl\html/lib/Pod/Simple.html">the Pod::Simple manpage</a> and inherits all its methods.</p> <p>A subclass of Pod::Simple::PullParser should define a <code>run</code> method that calls <a href="#get_token"><code>$token = $parser->get_token</code></a> to pull tokens.</p> <p>See the source for Pod::Simple::RTF for an example of a formatter that uses Pod::Simple::PullParser.</p> <p> </p> <hr /> <h1><a name="methods">METHODS</a></h1> <dl> <dt><strong><a name="get_token" class="item">my $token = $parser->get_token</a></strong> <dd> <p>This returns the next token object (which will be of a subclass of <a href="file://C|\ADE\aime_smenon_perl_090715\perl\html/lib/Pod/Simple/PullParserToken.html">the Pod::Simple::PullParserToken manpage</a>), or undef if the parser-stream has hit the end of the document.</p> </dd> </li> <dt><strong><a name="unget_token" class="item">$parser->unget_token( $token )</a></strong> <dt><strong>$parser->unget_token( $token1, $token2, ... )</strong> <dd> <p>This restores the token object(s) to the front of the parser stream.</p> </dd> </li> </dl> <p>The source has to be set before you can parse anything. The lowest-level way is to call <a href="#set_source"><code>set_source</code></a>:</p> <dl> <dt><strong><a name="set_source" class="item">$parser->set_source( $filename )</a></strong> <dt><strong>$parser->set_source( $filehandle_object )</strong> <dt><strong>$parser->set_source( \$document_source )</strong> <dt><strong>$parser->set_source( \@document_lines )</strong> </dl> <p>Or you can call these methods, which Pod::Simple::PullParser has defined to work just like Pod::Simple's same-named methods:</p> <dl> <dt><strong><a name="parse_file" class="item">$parser->parse_file(...)</a></strong> <dt><strong><a name="parse_string_document" class="item">$parser->parse_string_document(...)</a></strong> <dt><strong><a name="filter" class="item">$parser->filter(...)</a></strong> <dt><strong><a name="parse_from_file" class="item">$parser->parse_from_file(...)</a></strong> </dl> <p>For those to work, the Pod-processing subclass of Pod::Simple::PullParser has to have defined a $parser->run method -- so it is advised that all Pod::Simple::PullParser subclasses do so. See the Synopsis above, or the source for Pod::Simple::RTF.</p> <p>Authors of formatter subclasses might find these methods useful to call on a parser object that you haven't started pulling tokens from yet:</p> <dl> <dt><strong><a name="get_title" class="item">my $title_string = $parser->get_title</a></strong> <dd> <p>This tries to get the title string out of $parser, by getting some tokens, and scanning them for the title, and then ungetting them so that you can process the token-stream from the beginning.</p> </dd> <dd> <p>For example, suppose you have a document that starts out:</p> </dd> <dd> <pre> =head1 NAME Hoo::Boy::Wowza -- Stuff B<wow> yeah!</pre> </dd> <dd> <p>$parser->get_title on that document will return "Hoo::Boy::Wowza -- Stuff wow yeah!".</p> </dd> <dd> <p>In cases where get_title can't find the title, it will return empty-string ("").</p> </dd> </li> <dt><strong><a name="get_short_title" class="item">my $title_string = $parser->get_short_title</a></strong> <dd> <p>This is just like get_title, except that it returns just the modulename, if the title seems to be of the form "SomeModuleName -- description".</p> </dd> <dd> <p>For example, suppose you have a document that starts out:</p> </dd> <dd> <pre> =head1 NAME Hoo::Boy::Wowza -- Stuff B<wow> yeah!</pre> </dd> <dd> <p>then $parser->get_short_title on that document will return "Hoo::Boy::Wowza".</p> </dd> <dd> <p>But if the document starts out:</p> </dd> <dd> <pre> =head1 NAME Hooboy, stuff B<wow> yeah!</pre> </dd> <dd> <p>then $parser->get_short_title on that document will return "Hooboy, stuff wow yeah!".</p> </dd> <dd> <p>If the title can't be found, then get_short_title returns empty-string ("").</p> </dd> </li> <dt><strong><a name="get_author" class="item">$author_name = $parser->get_author</a></strong> <dd> <p>This works like get_title except that it returns the contents of the "=head1 AUTHOR\n\nParagraph...\n" section, assuming that that section isn't terribly long.</p> </dd> <dd> <p>(This method tolerates "AUTHORS" instead of "AUTHOR" too.)</p> </dd> </li> <dt><strong><a name="get_description" class="item">$description_name = $parser->get_description</a></strong> <dd> <p>This works like get_title except that it returns the contents of the "=head1 PARAGRAPH\n\nParagraph...\n" section, assuming that that section isn't terribly long.</p> </dd> </li> <dt><strong><a name="get_version" class="item">$version_block = $parser->get_version</a></strong> <dd> <p>This works like get_title except that it returns the contents of the "=head1 VERSION\n\n[BIG BLOCK]\n" block. Note that this does NOT return the module's <code>$VERSION</code>!!</p> </dd> </li> </dl> <p> </p> <hr /> <h1><a name="note">NOTE</a></h1> <p>You don't actually <em>have</em> to define a <code>run</code> method. If you're writing a Pod-formatter class, you should define a <code>run</code> just so that users can call <a href="#parse_file"><code>parse_file</code></a> etc, but you don't <em>have</em> to.</p> <p>And if you're not writing a formatter class, but are instead just writing a program that does something simple with a Pod::PullParser object (and not an object of a subclass), then there's no reason to bother subclassing to add a <code>run</code> method.</p> <p> </p> <hr /> <h1><a name="see_also">SEE ALSO</a></h1> <p><a href="file://C|\ADE\aime_smenon_perl_090715\perl\html/lib/Pod/Simple.html">the Pod::Simple manpage</a></p> <p><a href="file://C|\ADE\aime_smenon_perl_090715\perl\html/lib/Pod/Simple/PullParserToken.html">the Pod::Simple::PullParserToken manpage</a> -- and its subclasses <a href="file://C|\ADE\aime_smenon_perl_090715\perl\html/lib/Pod/Simple/PullParserStartToken.html">the Pod::Simple::PullParserStartToken manpage</a>, <a href="file://C|\ADE\aime_smenon_perl_090715\perl\html/lib/Pod/Simple/PullParserTextToken.html">the Pod::Simple::PullParserTextToken manpage</a>, and <a href="file://C|\ADE\aime_smenon_perl_090715\perl\html/lib/Pod/Simple/PullParserEndToken.html">the Pod::Simple::PullParserEndToken manpage</a>.</p> <p><a href="file://C|\ADE\aime_smenon_perl_090715\perl\html/HTML/TokeParser.html">the HTML::TokeParser manpage</a>, which inspired this.</p> <p> </p> <hr /> <h1><a name="copyright_and_disclaimers">COPYRIGHT AND DISCLAIMERS</a></h1> <p>Copyright (c) 2002 Sean M. Burke. All rights reserved.</p> <p>This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.</p> <p>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.</p> <p> </p> <hr /> <h1><a name="author">AUTHOR</a></h1> <p>Sean M. Burke <code>sburke@cpan.org</code></p> <table border="0" width="100%" cellspacing="0" cellpadding="3"> <tr><td class="block" style="background-color: #cccccc" valign="middle"> <big><strong><span class="block"> Pod::Simple::PullParser -- a pull-parser interface to parsing Pod</span></strong></big> </td></tr> </table> </body> </html>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de