⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pod::simple::subclassing.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
📖 第 1 页 / 共 3 页
字号:
\&    </Para>\&  </over\-text>.Ve.IP "events with an element_name of over-block" 4.IX Item "events with an element_name of over-block"These events are are somewhat unlike the other over\-*structures, as far as what their contents are.  Whenan \*(L"=over ... =back\*(R" block is parsed where there are no items,it will produce this event structure:.Sp.Vb 3\&  <over\-block indent="4" start_line="543">\&    ...stuff (generally Para or Verbatim elements)...\&  </over\-block>.Ve.SpThe \fIindent\fR attribute is as with the other over\-* events..SpFor example, this Pod source:.Sp.Vb 1\&  =over\&  \&  For cutting off our trade with all parts of the world\&  \&  For transporting us beyond seas to be tried for pretended offenses\&  \&  He is at this time transporting large armies of foreign mercenaries to\&  complete the works of death, desolation and tyranny, already begun with\&  circumstances of cruelty and perfidy scarcely paralleled in the most\&  barbarous ages, and totally unworthy the head of a civilized nation.\&  \&  =cut.Ve.Spwill produce this event structure:.Sp.Vb 11\&  <over\-block indent="4" start_line="2">\&    <Para start_line="4">\&      For cutting off our trade with all parts of the world\&    </Para>\&    <Para start_line="6">\&      For transporting us beyond seas to be tried for pretended offenses\&    </Para>\&    <Para start_line="8">\&      He is at this time transporting large armies of [...more text...]\&    </Para>\&  </over\-block>.Ve.IP "events with an element_name of item-bullet" 4.IX Item "events with an element_name of item-bullet"See \*(L"events with an element_name of over-bullet\*(R", above..IP "events with an element_name of item-number" 4.IX Item "events with an element_name of item-number"See \*(L"events with an element_name of over-number\*(R", above..IP "events with an element_name of item-text" 4.IX Item "events with an element_name of item-text"See \*(L"events with an element_name of over-text\*(R", above..IP "events with an element_name of for" 4.IX Item "events with an element_name of for"\&\s-1TODO\s0....IP "events with an element_name of Data" 4.IX Item "events with an element_name of Data"\&\s-1TODO\s0....SH "More Pod::Simple Methods".IX Header "More Pod::Simple Methods"Pod::Simple provides a lot of methods that aren't generally interestingto the end user of an existing Pod formatter, but some of which youmight find useful in writing a Pod formatter. They are listed below. Thefirst several methods (the accept_* methods) are for declaring thecapabilites of your parser, notably what \f(CW\*(C`=for \f(CItargetname\f(CW\*(C'\fR sectionsit's interested in, what extra N<...> codes it accepts beyondthe ones described in the \fIperlpod\fR..ie n .IP """$parser\->accept_targets( \f(CISOMEVALUE\f(CW )""" 4.el .IP "\f(CW$parser\->accept_targets( \f(CISOMEVALUE\f(CW )\fR" 4.IX Item "$parser->accept_targets( SOMEVALUE )"As the parser sees sections like:.Sp.Vb 1\&    =for html  <img src="fig1.jpg">.Ve.Spor.Sp.Vb 1\&    =begin html\&\&      <img src="fig1.jpg">\&\&    =end html.Ve.Sp\&...the parser will ignore these sections unless your subclass hasspecified that it wants to see sections targetted to \*(L"html\*(R" (or whateverthe formatter name is)..SpIf you want to process all sections, even if they're not targetted for you,call this before you start parsing:.Sp.Vb 1\&  $parser\->accept_targets(\*(Aq*\*(Aq);.Ve.ie n .IP """$parser\->accept_targets_as_text(  \f(CISOMEVALUE\f(CW  )""" 4.el .IP "\f(CW$parser\->accept_targets_as_text(  \f(CISOMEVALUE\f(CW  )\fR" 4.IX Item "$parser->accept_targets_as_text(  SOMEVALUE  )"This is like accept_targets, except that it specifies also that thecontent of sections for this target should be treated as Pod text evenif the target name in "=for \fItargetname\fR\*(L" doesn't start with a \*(R":"..SpAt time of writing, I don't think you'll need to use this..ie n .IP """$parser\->accept_codes( \f(CICodename\f(CW, \f(CICodename\f(CW...  )""" 4.el .IP "\f(CW$parser\->accept_codes( \f(CICodename\f(CW, \f(CICodename\f(CW...  )\fR" 4.IX Item "$parser->accept_codes( Codename, Codename...  )"This tells the parser that you accept additional formatting codes,beyond just the standard ones (I B C L F S X, plus the two weird onesyou don't actually see in the parse tree, Z and E). For example, to alsoaccept codes \*(L"N\*(R", \*(L"R\*(R", and \*(L"W\*(R":.Sp.Vb 1\&    $parser\->accept_codes( qw( N R W ) );.Ve.Sp\&\fB\s-1TODO:\s0 document how this interacts with =extend, and long element names\fR.ie n .IP """$parser\->accept_directive_as_data( \f(CIdirective_name\f(CW )""" 4.el .IP "\f(CW$parser\->accept_directive_as_data( \f(CIdirective_name\f(CW )\fR" 4.IX Item "$parser->accept_directive_as_data( directive_name )".PD 0.ie n .IP """$parser\->accept_directive_as_verbatim( \f(CIdirective_name\f(CW )""" 4.el .IP "\f(CW$parser\->accept_directive_as_verbatim( \f(CIdirective_name\f(CW )\fR" 4.IX Item "$parser->accept_directive_as_verbatim( directive_name )".ie n .IP """$parser\->accept_directive_as_processed( \f(CIdirective_name\f(CW )""" 4.el .IP "\f(CW$parser\->accept_directive_as_processed( \f(CIdirective_name\f(CW )\fR" 4.IX Item "$parser->accept_directive_as_processed( directive_name )".PDIn the unlikely situation that you need to tell the parser that you willaccept additional directives (\*(L"=foo\*(R" things), you need to first set theparset to treat its content as data (i.e., not really processed atall), or as verbatim (mostly just expanding tabs), or as processed text(parsing formatting codes like B<...>)..SpFor example, to accept a new directive \*(L"=method\*(R", you'd presumablyuse:.Sp.Vb 1\&    $parser\->accept_directive_as_processed("method");.Ve.Spso that you could have Pod lines like:.Sp.Vb 1\&    =method I<$whatever> thing B<um>.Ve.SpMaking up your own directives breaks compatibility with other Podformatters, in a way that using "=for \fItarget\fR ..." lines doesn't;however, you may find this useful if you're making a Pod supersetformat where you don't need to worry about compatibility..ie n .IP """$parser\->nbsp_for_S( \f(CIBOOLEAN\f(CW );""" 4.el .IP "\f(CW$parser\->nbsp_for_S( \f(CIBOOLEAN\f(CW );\fR" 4.IX Item "$parser->nbsp_for_S( BOOLEAN );"Setting this attribute to a true value (and by default it is false) willturn \*(L"S<...>\*(R" sequences into sequences of words separated by\&\f(CW\*(C`\exA0\*(C'\fR (non-breaking space) characters. For example, it will take this:.Sp.Vb 1\&    I like S<Dutch apple pie>, don\*(Aqt you?.Ve.Spand treat it as if it were:.Sp.Vb 1\&    I like DutchE<nbsp>appleE<nbsp>pie, don\*(Aqt you?.Ve.SpThis is handy for output formats that don't have anything quite like an\&\*(L"S<...>\*(R" code, but which do have a code for non-breaking space..SpThere is currently no method for going the other way; but I canprobably provide one upon request..ie n .IP """$parser\->version_report()""" 4.el .IP "\f(CW$parser\->version_report()\fR" 4.IX Item "$parser->version_report()"This returns a string reporting the \f(CW$VERSION\fR value from your module (andits classname) as well as the \f(CW$VERSION\fR value of Pod::Simple.  Note thatperlpodspec requires output formats (wherever possible) to notethis detail in a comment in the output format.  For example, forsome kind of \s-1SGML\s0 output format:.Sp.Vb 1\&    print OUT "<!\-\- \en", $parser\->version_report, "\en \-\->";.Ve.ie n .IP """$parser\->pod_para_count()""" 4.el .IP "\f(CW$parser\->pod_para_count()\fR" 4.IX Item "$parser->pod_para_count()"This returns the count of Pod paragraphs seen so far..ie n .IP """$parser\->line_count()""" 4.el .IP "\f(CW$parser\->line_count()\fR" 4.IX Item "$parser->line_count()"This is the current line number being parsed. But you might find the\&\*(L"line_number\*(R" event attribute more accurate, when it is present..ie n .IP """$parser\->nix_X_codes(  \f(CISOMEVALUE\f(CW  )""" 4.el .IP "\f(CW$parser\->nix_X_codes(  \f(CISOMEVALUE\f(CW  )\fR" 4.IX Item "$parser->nix_X_codes(  SOMEVALUE  )"This attribute, when set to a true value (and it is false by default)ignores any \*(L"X<...>\*(R" sequences in the document being parsed.Many formats don't actually use the content of these codes, so haveno reason to process them..ie n .IP """$parser\->merge_text(  \f(CISOMEVALUE\f(CW  )""" 4.el .IP "\f(CW$parser\->merge_text(  \f(CISOMEVALUE\f(CW  )\fR" 4.IX Item "$parser->merge_text(  SOMEVALUE  )"This attribute, when set to a true value (and it is false by default)makes sure that only one event (or token, or node) will be createdfor any single contiguous sequence of text.  For example, considerthis somewhat contrived example:.Sp.Vb 1\&    I just LOVE Z<>hotE<32>apple pie!.Ve.SpWhen that is parsed and events are about to be called on it, it mayactually seem to be four different text events, one right after another:one event for \*(L"I just \s-1LOVE\s0 \*(R", one for \*(L"hot\*(R", one for \*(L" \*(R", and one for\&\*(L"apple pie!\*(R". But if you have merge_text on, then you're guaranteedthat it will be fired as one text event:  \*(L"I just \s-1LOVE\s0 hot apple pie!\*(R"..ie n .IP """$parser\->code_handler(  \f(CICODE_REF\f(CW  )""" 4.el .IP "\f(CW$parser\->code_handler(  \f(CICODE_REF\f(CW  )\fR" 4.IX Item "$parser->code_handler(  CODE_REF  )"This specifies code that should be called when a code line is seen(i.e., a line outside of the Pod).  Normally this is undef, meaningthat no code should be called.  If you provide a routine, it shouldstart out like this:.Sp.Vb 4\&    sub get_code_line {  # or whatever you\*(Aqll call it\&      my($line, $line_number, $parser) = @_;\&      ...\&    }.Ve.SpNote, however, that sometimes the Pod events aren't processed in exactlythe same order as the code lines are \*(-- i.e., if you have a file withPod, then code, then more Pod, sometimes the code will be processed (viawhatever you have code_handler call) before the all of the preceding Podhas been processed..ie n .IP """$parser\->cut_handler(  \f(CICODE_REF\f(CW  )""" 4.el .IP "\f(CW$parser\->cut_handler(  \f(CICODE_REF\f(CW  )\fR" 4.IX Item "$parser->cut_handler(  CODE_REF  )"This is just like the code_handler attribute, except that it's for\&\*(L"=cut\*(R" lines, not code lines. The same caveats apply. \*(L"=cut\*(R" lines areunlikely to be interesting, but this is included for completeness..ie n .IP """$parser\->whine( \f(CIlinenumber\f(CW, \f(CIcomplaint string\f(CW )""" 4.el .IP "\f(CW$parser\->whine( \f(CIlinenumber\f(CW, \f(CIcomplaint string\f(CW )\fR" 4.IX Item "$parser->whine( linenumber, complaint string )"This notes a problem in the Pod, which will be reported to in the \*(L"PodErrors\*(R" section of the document and/or send to \s-1STDERR\s0, depending on thevalues of the attributes \f(CW\*(C`no_whining\*(C'\fR, \f(CW\*(C`no_errata_section\*(C'\fR, and\&\f(CW\*(C`complain_stderr\*(C'\fR..ie n .IP """$parser\->scream( \f(CIlinenumber\f(CW, \f(CIcomplaint string\f(CW )""" 4.el .IP "\f(CW$parser\->scream( \f(CIlinenumber\f(CW, \f(CIcomplaint string\f(CW )\fR" 4.IX Item "$parser->scream( linenumber, complaint string )"This notes an error like \f(CW\*(C`whine\*(C'\fR does, except that it is notsuppressable with \f(CW\*(C`no_whining\*(C'\fR. This should be used only for veryserious errors..ie n .IP """$parser\->source_dead(1)""" 4.el .IP "\f(CW$parser\->source_dead(1)\fR" 4.IX Item "$parser->source_dead(1)"This aborts parsing of the current document, by switching on the flagthat indicates that \s-1EOF\s0 has been seen.  In particularly drastic cases,you might want to do this.  It's rather nicer than just calling\&\f(CW\*(C`die\*(C'\fR!.ie n .IP """$parser\->hide_line_numbers( \f(CISOMEVALUE\f(CW )""" 4.el .IP "\f(CW$parser\->hide_line_numbers( \f(CISOMEVALUE\f(CW )\fR" 4.IX Item "$parser->hide_line_numbers( SOMEVALUE )"Some subclasses that indescriminately dump event attributes (well,except for ones beginning with \*(L"~\*(R") can use this object attribute forrefraining to dump the \*(L"start_line\*(R" attribute..ie n .IP """$parser\->no_whining( \f(CISOMEVALUE\f(CW )""" 4.el .IP "\f(CW$parser\->no_whining( \f(CISOMEVALUE\f(CW )\fR" 4.IX Item "$parser->no_whining( SOMEVALUE )"This attribute, if set to true, will suppress reports of non-fatalerror messages.  The default value is false, meaning that complaints\&\fIare\fR reported.  How they get reported depends on the values ofthe attributes \f(CW\*(C`no_errata_section\*(C'\fR and \f(CW\*(C`complain_stderr\*(C'\fR..ie n .IP """$parser\->no_errata_section( \f(CISOMEVALUE\f(CW )""" 4.el .IP "\f(CW$parser\->no_errata_section( \f(CISOMEVALUE\f(CW )\fR" 4.IX Item "$parser->no_errata_section( SOMEVALUE )"This attribute, if set to true, will suppress generation of an erratasection.  The default value is false \*(-- i.e., an errata section will begenerated..ie n .IP """$parser\->complain_stderr( \f(CISOMEVALUE\f(CW )""" 4.el .IP "\f(CW$parser\->complain_stderr( \f(CISOMEVALUE\f(CW )\fR" 4.IX Item "$parser->complain_stderr( SOMEVALUE )"This attribute, if set to true will send complaints to \s-1STDERR\s0.  Thedefault value is false \*(-- i.e., complaints do not go to \s-1STDERR\s0..ie n .IP """$parser\->bare_output( \f(CISOMEVALUE\f(CW )""" 4.el .IP "\f(CW$parser\->bare_output( \f(CISOMEVALUE\f(CW )\fR" 4.IX Item "$parser->bare_output( SOMEVALUE )"Some formatter subclasses use this as a flag for whether output shouldhave prologue and epilogue code omitted. For example, setting this totrue for an \s-1HTML\s0 formatter class should omit the\&\*(L"<html><head><title>...</title><body>...\*(R" prologue and the\&\*(L"</body></html>\*(R" epilogue..SpIf you want to set this to true, you should probably also set\&\f(CW\*(C`no_whining\*(C'\fR or at least \f(CW\*(C`no_errata_section\*(C'\fR to true..ie n .IP """$parser\->preserve_whitespace( \f(CISOMEVALUE\f(CW )""" 4.el .IP "\f(CW$parser\->preserve_whitespace( \f(CISOMEVALUE\f(CW )\fR" 4.IX Item "$parser->preserve_whitespace( SOMEVALUE )"If you set this attribute to a true value, the parser will try topreserve whitespace in the output.  This means that such formattingconventions as two spaces after periods will be preserved by the parser.This is primarily useful for output formats that treat whitespace assignificant (such as text or *roff, but not \s-1HTML\s0)..SH "SEE ALSO".IX Header "SEE ALSO"Pod::Simple \*(-- event-based Pod-parsing framework.PPPod::Simple::Methody \*(-- like Pod::Simple, but each sort of eventcalls its own method (like \f(CW\*(C`start_head3\*(C'\fR).PPPod::Simple::PullParser \*(-- a Pod-parsing framework like Pod::Simple,but with a token-stream interface.PPPod::Simple::SimpleTree \*(-- a Pod-parsing framework like Pod::Simple,but with a tree interface.PPPod::Simple::Checker \*(-- a simple Pod::Simple subclass that readsdocuments, and then makes a plaintext report of any errors found in thedocument.PPPod::Simple::DumpAsXML \*(-- for dumping Pod documents as tidilyindented \s-1XML\s0, showing each event on its own line.PPPod::Simple::XMLOutStream \*(-- dumps a Pod document as \s-1XML\s0 (withoutintroducing extra whitespace as Pod::Simple::DumpAsXML does)..PPPod::Simple::DumpAsText \*(-- for dumping Pod documents as tidilyindented text, showing each event on its own line.PPPod::Simple::LinkSection \*(-- class for objects representing the valuesof the \s-1TODO\s0 and \s-1TODO\s0 attributes of L<...> elements.PPPod::Escapes \*(-- the module the Pod::Simple uses for evaluatingE<...> content.PPPod::Simple::Text \*(-- a simple plaintext formatter for Pod.PPPod::Simple::TextContent \*(-- like Pod::Simple::Text, butmakes no effort for indent or wrap the text being formatted.PPperlpod.PPperlpodspec.PPperldoc.SH "COPYRIGHT AND DISCLAIMERS".IX Header "COPYRIGHT AND DISCLAIMERS"Copyright (c) 2002 Sean M. Burke.  All rights reserved..PPThis library is free software; you can redistribute it and/or modify itunder the same terms as Perl itself..PPThis program is distributed in the hope that it will be useful, butwithout any warranty; without even the implied warranty ofmerchantability or fitness for a particular purpose..SH "AUTHOR".IX Header "AUTHOR"Sean M. Burke \f(CW\*(C`sburke@cpan.org\*(C'\fR

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -