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

📄 perlpodspec.pod

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 POD
📖 第 1 页 / 共 5 页
字号:
=head1 NAMEperlpodspec - Plain Old Documentation: format specification and notes=head1 DESCRIPTIONThis document is detailed notes on the Pod markup language.  Mostpeople will only have to read L<perlpod|perlpod> to know how to writein Pod, but this document may answer some incidental questions to dowith parsing and rendering Pod.In this document, "must" / "must not", "should" /"should not", and "may" have their conventional (cf. RFC 2119)meanings: "X must do Y" means that if X doesn't do Y, it's againstthis specification, and should really be fixed.  "X should do Y"means that it's recommended, but X may fail to do Y, if there's agood reason.  "X may do Y" is merely a note that X can do Y atwill (although it is up to the reader to detect any connotation of"and I think it would be I<nice> if X did Y" versus "it wouldn'treally I<bother> me if X did Y").Notably, when I say "the parser should do Y", theparser may fail to do Y, if the calling application explicitlyrequests that the parser I<not> do Y.  I often phrase this as"the parser should, by default, do Y."  This doesn't I<require>the parser to provide an option for turning off whateverfeature Y is (like expanding tabs in verbatim paragraphs), althoughit implicates that such an option I<may> be provided.=head1 Pod DefinitionsPod is embedded in files, typically Perl source files -- although youcan write a file that's nothing but Pod.A B<line> in a file consists of zero or more non-newline characters,terminated by either a newline or the end of the file.A B<newline sequence> is usually a platform-dependent concept, butPod parsers should understand it to mean any of CR (ASCII 13), LF(ASCII 10), or a CRLF (ASCII 13 followed immediately by ASCII 10), inaddition to any other system-specific meaning.  The first CR/CRLF/LFsequence in the file may be used as the basis for identifying thenewline sequence for parsing the rest of the file.A B<blank line> is a line consisting entirely of zero or more spaces(ASCII 32) or tabs (ASCII 9), and terminated by a newline or end-of-file.A B<non-blank line> is a line containing one or more characters otherthan space or tab (and terminated by a newline or end-of-file).(I<Note:> Many older Pod parsers did not accept a line consisting ofspaces/tabs and then a newline as a blank line -- the only lines theyconsidered blank were lines consisting of I<no characters at all>,terminated by a newline.)B<Whitespace> is used in this document as a blanket term for spaces,tabs, and newline sequences.  (By itself, this term usually refersto literal whitespace.  That is, sequences of whitespace charactersin Pod source, as opposed to "EE<lt>32>", which is a formattingcode that I<denotes> a whitespace character.)A B<Pod parser> is a module meant for parsing Pod (regardless ofwhether this involves calling callbacks or building a parse tree ordirectly formatting it).  A B<Pod formatter> (or B<Pod translator>)is a module or program that converts Pod to some other format (HTML,plaintext, TeX, PostScript, RTF).  A B<Pod processor> might be aformatter or translator, or might be a program that does somethingelse with the Pod (like counting words, scanning for index points,etc.).Pod content is contained in B<Pod blocks>.  A Pod block starts with aline that matches <m/\A=[a-zA-Z]/>, and continues up to the next linethat matches C<m/\A=cut/> -- or up to the end of the file, if there isno C<m/\A=cut/> line.=for comment The current perlsyn says: [beginquote]   Note that pod translators should look at only paragraphs beginning   with a pod directive (it makes parsing easier), whereas the compiler   actually knows to look for pod escapes even in the middle of a   paragraph.  This means that the following secret stuff will be ignored   by both the compiler and the translators.      $a=3;      =secret stuff       warn "Neither POD nor CODE!?"      =cut back      print "got $a\n";   You probably shouldn't rely upon the warn() being podded out forever.   Not all pod translators are well-behaved in this regard, and perhaps   the compiler will become pickier. [endquote] I think that those paragraphs should just be removed; paragraph-based parsing  seems to have been largely abandoned, because of the hassle with non-empty blank lines messing up what people meant by "paragraph". Even if the "it makes parsing easier" bit were especially true, it wouldn't be worth the confusion of having perl and pod2whatever actually disagree on what can constitute a Pod block.Within a Pod block, there are B<Pod paragraphs>.  A Pod paragraphconsists of non-blank lines of text, separated by one or more blanklines.For purposes of Pod processing, there are four types of paragraphs ina Pod block:=over=item *A command paragraph (also called a "directive").  The first line ofthis paragraph must match C<m/\A=[a-zA-Z]/>.  Command paragraphs aretypically one line, as in:  =head1 NOTES  =item *But they may span several (non-blank) lines:  =for comment  Hm, I wonder what it would look like if  you tried to write a BNF for Pod from this.  =head3 Dr. Strangelove, or: How I Learned to  Stop Worrying and Love the BombI<Some> command paragraphs allow formatting codes in their content(i.e., after the part that matches C<m/\A=[a-zA-Z]\S*\s*/>), as in:  =head1 Did You Remember to C<use strict;>?In other words, the Pod processing handler for "head1" will apply thesame processing to "Did You Remember to CE<lt>use strict;>?" that itwould to an ordinary paragraph -- i.e., formatting codes (like"CE<lt>...>") are parsed and presumably formatted appropriately, andwhitespace in the form of literal spaces and/or tabs is notsignificant.=item *A B<verbatim paragraph>.  The first line of this paragraph must be aliteral space or tab, and this paragraph must not be inside a "=beginI<identifier>", ... "=end I<identifier>" sequence unless"I<identifier>" begins with a colon (":").  That is, if a paragraphstarts with a literal space or tab, but I<is> inside a"=begin I<identifier>", ... "=end I<identifier>" region, then it'sa data paragraph, unless "I<identifier>" begins with a colon.Whitespace I<is> significant in verbatim paragraphs (although, inprocessing, tabs are probably expanded).=item *An B<ordinary paragraph>.  A paragraph is an ordinary paragraphif its first line matches neither C<m/\A=[a-zA-Z]/> norC<m/\A[ \t]/>, I<and> if it's not inside a "=begin I<identifier>",... "=end I<identifier>" sequence unless "I<identifier>" begins witha colon (":").=item *A B<data paragraph>.  This is a paragraph that I<is> inside a "=beginI<identifier>" ... "=end I<identifier>" sequence where"I<identifier>" does I<not> begin with a literal colon (":").  Insome sense, a data paragraph is not part of Pod at all (i.e.,effectively it's "out-of-band"), since it's not subject to most kindsof Pod parsing; but it is specified here, since Podparsers need to be able to call an event for it, or store it in someform in a parse tree, or at least just parse I<around> it.=backFor example: consider the following paragraphs:  # <- that's the 0th column  =head1 Foo  Stuff    $foo->bar  =cutHere, "=head1 Foo" and "=cut" are command paragraphs because the firstline of each matches C<m/\A=[a-zA-Z]/>.  "I<[space][space]>$foo->bar"is a verbatim paragraph, because its first line starts with a literalwhitespace character (and there's no "=begin"..."=end" region around).The "=begin I<identifier>" ... "=end I<identifier>" commands stopparagraphs that they surround from being parsed as data or verbatimparagraphs, if I<identifier> doesn't begin with a colon.  Thisis discussed in detail in the sectionL</About Data Paragraphs and "=beginE<sol>=end" Regions>.=head1 Pod CommandsThis section is intended to supplement and clarify the discussion inL<perlpod/"Command Paragraph">.  These are the currently recognizedPod commands:=over=item "=head1", "=head2", "=head3", "=head4"This command indicates that the text in the remainder of the paragraphis a heading.  That text may contain formatting codes.  Examples:  =head1 Object Attributes  =head3 What B<Not> to Do!=item "=pod"This command indicates that this paragraph begins a Pod block.  (If weare already in the middle of a Pod block, this command has no effect atall.)  If there is any text in this command paragraph after "=pod",it must be ignored.  Examples:  =pod  This is a plain Pod paragraph.  =pod This text is ignored.=item "=cut"This command indicates that this line is the end of this previouslystarted Pod block.  If there is any text after "=cut" on the line, it must beignored.  Examples:  =cut  =cut The documentation ends here.  =cut  # This is the first line of program text.  sub foo { # This is the second.It is an error to try to I<start> a Pod block with a "=cut" command.  Inthat case, the Pod processor must halt parsing of the input file, andmust by default emit a warning.=item "=over"This command indicates that this is the start of a list/indentregion.  If there is any text following the "=over", it must consistof only a nonzero positive numeral.  The semantics of this numeral isexplained in the L</"About =over...=back Regions"> section, furtherbelow.  Formatting codes are not expanded.  Examples:  =over 3  =over 3.5  =over=item "=item"This command indicates that an item in a list begins here.  Formattingcodes are processed.  The semantics of the (optional) text in theremainder of this paragraph areexplained in the L</"About =over...=back Regions"> section, furtherbelow.  Examples:  =item  =item *  =item      *      =item 14  =item   3.  =item C<< $thing->stuff(I<dodad>) >>  =item For transporting us beyond seas to be tried for pretended  offenses  =item 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.=item "=back"This command indicates that this is the end of the region begunby the most recent "=over" command.  It permits no text after the"=back" command.=item "=begin formatname"This marks the following paragraphs (until the matching "=endformatname") as being for some special kind of processing.  Unless"formatname" begins with a colon, the contained non-commandparagraphs are data paragraphs.  But if "formatname" I<does> beginwith a colon, then non-command paragraphs are ordinary paragraphsor data paragraphs.  This is discussed in detail in the sectionL</About Data Paragraphs and "=beginE<sol>=end" Regions>.It is advised that formatnames match the regexpC<m/\A:?[-a-zA-Z0-9_]+\z/>.  Implementors should anticipate futureexpansion in the semantics and syntax of the first parameterto "=begin"/"=end"/"=for".=item "=end formatname"This marks the end of the region opened by the matching"=begin formatname" region.  If "formatname" is not the formatnameof the most recent open "=begin formatname" region, then thisis an error, and must generate an error message.  Thisis discussed in detail in the sectionL</About Data Paragraphs and "=beginE<sol>=end" Regions>.=item "=for formatname text..."This is synonymous with:     =begin formatname     text...     =end formatnameThat is, it creates a region consisting of a single paragraph; thatparagraph is to be treated as a normal paragraph if "formatname"begins with a ":"; if "formatname" I<doesn't> begin with a colon,then "text..." will constitute a data paragraph.  There is no wayto use "=for formatname text..." to express "text..." as a verbatimparagraph.=item "=encoding encodingname"This command, which should occur early in the document (at leastbefore any non-US-ASCII data!), declares that this document isencoded in the encoding I<encodingname>, which must bean encoding name that L<Encoding> recognizes.  (Encoding's listof supported encodings, in L<Encoding::Supported>, is useful here.)If the Pod parser cannot decode the declared encoding, it should emit a warning and may abort parsing the documentaltogether.A document having more than one "=encoding" line should beconsidered an error.  Pod processors may silently tolerate this ifthe not-first "=encoding" lines are just duplicates of thefirst one (e.g., if there's a "=use utf8" line, and later onanother "=use utf8" line).  But Pod processors should complain ifthere are contradictory "=encoding" lines in the same document(e.g., if there is a "=encoding utf8" early in the document and"=encoding big5" later).  Pod processors that recognize BOMsmay also complain if they see an "=encoding" linethat contradicts the BOM (e.g., if a document with a UTF-16LEBOM has an "=encoding shiftjis" line).=backIf a Pod processor sees any command other than the ones listedabove (like "=head", or "=haed1", or "=stuff", or "=cuttlefish",or "=w123"), that processor must by default treat this as anerror.  It must not process the paragraph beginning with thatcommand, must by default warn of this as an error, and may

⌨️ 快捷键说明

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