perlpod.pod
来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· POD 代码 · 共 731 行 · 第 1/2 页
POD
731 行
form of computerese ("C<CE<lt>drwxr-xr-xE<gt>>").=item C<LE<lt>nameE<gt>> -- a hyperlinkX<L> X<< LZ<><> >> X<POD, formatting code, hyperlink> X<hyperlink>There are various syntaxes, listed below. In the syntaxes given,C<text>, C<name>, and C<section> cannot contain the characters'/' and '|'; and any '<' or '>' should be matched.=over=item *C<LE<lt>nameE<gt>>Link to a Perl manual page (e.g., C<LE<lt>Net::PingE<gt>>). Notethat C<name> should not contain spaces. This syntaxis also occasionally used for references to UNIX man pages, as inC<LE<lt>crontab(5)E<gt>>.=item *C<LE<lt>name/"sec"E<gt>> or C<LE<lt>name/secE<gt>>Link to a section in other manual page. E.g.,C<LE<lt>perlsyn/"For Loops"E<gt>>=item *C<LE<lt>/"sec"E<gt>> or C<LE<lt>/secE<gt>> or C<LE<lt>"sec"E<gt>>Link to a section in this manual page. E.g.,C<LE<lt>/"Object Methods"E<gt>>=backA section is started by the named heading or item. Forexample, C<LE<lt>perlvar/$.E<gt>> or C<LE<lt>perlvar/"$."E<gt>> bothlink to the section started by "C<=item $.>" in perlvar. AndC<LE<lt>perlsyn/For LoopsE<gt>> or C<LE<lt>perlsyn/"For Loops"E<gt>>both link to the section started by "C<=head2 For Loops>"in perlsyn.To control what text is used for display, youuse "C<LE<lt>text|...E<gt>>", as in:=over=item *C<LE<lt>text|nameE<gt>>Link this text to that manual page. E.g.,C<LE<lt>Perl Error Messages|perldiagE<gt>>=item *C<LE<lt>text|name/"sec"E<gt>> or C<LE<lt>text|name/secE<gt>>Link this text to that section in that manual page. E.g.,C<LE<lt>postfix "if"|perlsyn/"Statement Modifiers"E<gt>>=item *C<LE<lt>text|/"sec"E<gt>> or C<LE<lt>text|/secE<gt>>or C<LE<lt>text|"sec"E<gt>>Link this text to that section in this manual page. E.g.,C<LE<lt>the various attributes|/"Member Data"E<gt>>=backOr you can link to a web page:=over=item *C<LE<lt>scheme:...E<gt>>Links to an absolute URL. For example,C<LE<lt>http://www.perl.org/E<gt>>. But notethat there is no corresponding C<LE<lt>text|scheme:...E<gt>> syntax, forvarious reasons.=back=item C<EE<lt>escapeE<gt>> -- a character escapeX<E> X<< EZ<><> >> X<POD, formatting code, escape> X<escape>Very similar to HTML/XML C<&I<foo>;> "entity references":=over=item *C<EE<lt>ltE<gt>> -- a literal E<lt> (less than)=item *C<EE<lt>gtE<gt>> -- a literal E<gt> (greater than)=item *C<EE<lt>verbarE<gt>> -- a literal | (I<ver>tical I<bar>)=item *C<EE<lt>solE<gt>> = a literal / (I<sol>idus)The above four are optional except in other formatting codes,notably C<LE<lt>...E<gt>>, and when preceded by acapital letter.=item *C<EE<lt>htmlnameE<gt>>Some non-numeric HTML entity name, such as C<EE<lt>eacuteE<gt>>,meaning the same thing as C<é> in HTML -- i.e., a lowercasee with an acute (/-shaped) accent.=item *C<EE<lt>numberE<gt>>The ASCII/Latin-1/Unicode character with that number. Aleading "0x" means that I<number> is hex, as inC<EE<lt>0x201EE<gt>>. A leading "0" means that I<number> is octal,as in C<EE<lt>075E<gt>>. Otherwise I<number> is interpreted as beingin decimal, as in C<EE<lt>181E<gt>>.Note that older Pod formatters might not recognize octal orhex numeric escapes, and that many formatters cannot reliablyrender characters above 255. (Some formatters may even haveto use compromised renderings of Latin-1 characters, likerendering C<EE<lt>eacuteE<gt>> as just a plain "e".)=back=item C<FE<lt>filenameE<gt>> -- used for filenamesX<F> X<< FZ<><> >> X<POD, formatting code, filename> X<filename>Typically displayed in italics. Example: "C<FE<lt>.cshrcE<gt>>"=item C<SE<lt>textE<gt>> -- text contains non-breaking spacesX<S> X<< SZ<><> >> X<POD, formatting code, non-breaking space> X<non-breaking space>This means that the words in I<text> should not be brokenacross lines. Example: S<C<SE<lt>$x ? $y : $zE<gt>>>.=item C<XE<lt>topic nameE<gt>> -- an index entryX<X> X<< XZ<><> >> X<POD, formatting code, index entry> X<index entry>This is ignored by most formatters, but some may use it for buildingindexes. It always renders as empty-string.Example: C<XE<lt>absolutizing relative URLsE<gt>>=item C<ZE<lt>E<gt>> -- a null (zero-effect) formatting codeX<Z> X<< ZZ<><> >> X<POD, formatting code, null> X<null>This is rarely used. It's one way to get around using anEE<lt>...E<gt> code sometimes. For example, instead of"C<NEE<lt>ltE<gt>3>" (for "NE<lt>3") you could write"C<NZE<lt>E<gt>E<lt>3>" (the "ZE<lt>E<gt>" breaks up the "N" andthe "E<lt>" so they can't be consideredthe part of a (fictitious) "NE<lt>...E<gt>" code.=for comment This was formerly explained as a "zero-width character". But it in most parser models, it parses to nothing at all, as opposed to parsing as if it were a E<zwnj> or E<zwj>, which are REAL zero-width characters. So "width" and "character" are exactly the wrong words.=backMost of the time, you will need only a single set of angle brackets todelimit the beginning and end of formatting codes. However,sometimes you will want to put a real right angle bracket (agreater-than sign, '>') inside of a formatting code. This is particularlycommon when using a formatting code to provide a different font-type for asnippet of code. As with all things in Perl, there is more thanone way to do it. One way is to simply escape the closing bracketusing an C<E> code: C<$a E<lt>=E<gt> $b>This will produce: "C<$a E<lt>=E<gt> $b>"A more readable, and perhaps more "plain" way is to use an alternateset of delimiters that doesn't require a single ">" to be escaped. Withthe Pod formatters that are standard starting with perl5.5.660, doubledangle brackets ("<<" and ">>") may be used I<if and only if there iswhitespace right after the opening delimiter and whitespace rightbefore the closing delimiter!> For example, the following willdo the trick:X<POD, formatting code, escaping with multiple brackets> C<< $a <=> $b >>In fact, you can use as many repeated angle-brackets as you like solong as you have the same number of them in the opening and closingdelimiters, and make sure that whitespace immediately follows the last'<' of the opening delimiter, and immediately precedes the first '>'of the closing delimiter. (The whitespace is ignored.) So thefollowing will also work:X<POD, formatting code, escaping with multiple brackets> C<<< $a <=> $b >>> C<<<< $a <=> $b >>>>And they all mean exactly the same as this: C<$a E<lt>=E<gt> $b>As a further example, this means that if you wanted to put these bits ofcode in C<C> (code) style: open(X, ">>thing.dat") || die $! $foo->bar();you could do it like so: C<<< open(X, ">>thing.dat") || die $! >>> C<< $foo->bar(); >>which is presumably easier to read than the old way: C<open(X, "E<gt>E<gt>thing.dat") || die $!> C<$foo-E<gt>bar();>This is currently supported by pod2text (Pod::Text), pod2man (Pod::Man),and any other pod2xxx or Pod::Xxxx translators that usePod::Parser 1.093 or later, or Pod::Tree 1.02 or later.=head2 The IntentX<POD, intent of>The intent is simplicity of use, not power of expression. Paragraphslook like paragraphs (block format), so that they stand outvisually, and so that I could run them through C<fmt> easily to reformatthem (that's F7 in my version of B<vi>, or Esc Q in my version ofB<emacs>). I wanted the translator to always leave the C<'> and C<`> andC<"> quotes alone, in verbatim mode, so I could slurp in aworking program, shift it over four spaces, and have it print out, er,verbatim. And presumably in a monospace font.The Pod format is not necessarily sufficient for writing a book. Podis just meant to be an idiot-proof common source for nroff, HTML,TeX, and other markup languages, as used for onlinedocumentation. Translators exist for B<pod2text>, B<pod2html>,B<pod2man> (that's for nroff(1) and troff(1)), B<pod2latex>, andB<pod2fm>. Various others are available in CPAN.=head2 Embedding Pods in Perl ModulesX<POD, embedding>You can embed Pod documentation in your Perl modules and scripts.Start your documentation with an empty line, a "=head1" command at thebeginning, and end it with a "=cut" command and an empty line. Perlwill ignore the Pod text. See any of the supplied library modules forexamples. If you're going to put your Pod at the end of the file, andyou're using an __END__ or __DATA__ cut mark, make sure to put anempty line there before the first Pod command. __END__ =head1 NAME Time::Local - efficiently compute time from local and GMT timeWithout that empty line before the "=head1", many translators wouldn'thave recognized the "=head1" as starting a Pod block.=head2 Hints for Writing Pod=over=item *X<podchecker> X<POD, validating>The B<podchecker> command is provided for checking Pod syntax for errorsand warnings. For example, it checks for completely blank lines inPod blocks and for unknown commands and formatting codes. You shouldstill also pass your document through one or more translators and proofreadthe result, or print out the result and proofread that. Some of theproblems found may be bugs in the translators, which you may or may notwish to work around.=item *If you're more familiar with writing in HTML than with writing in Pod, youcan try your hand at writing documentation in simple HTML, and convertingit to Pod with the experimental L<Pod::HTML2Pod|Pod::HTML2Pod> module,(available in CPAN), and looking at the resulting code. The experimentalL<Pod::PXML|Pod::PXML> module in CPAN might also be useful.=item *Many older Pod translators require the lines before every Podcommand and after every Pod command (including "=cut"!) to be a blankline. Having something like this: # - - - - - - - - - - - - =item $firecracker->boom() This noisily detonates the firecracker object. =cut sub boom { ......will make such Pod translators completely fail to see the Pod blockat all.Instead, have it like this: # - - - - - - - - - - - - =item $firecracker->boom() This noisily detonates the firecracker object. =cut sub boom { ...=item *Some older Pod translators require paragraphs (including commandparagraphs like "=head2 Functions") to be separated by I<completely>empty lines. If you have an apparently empty line with some spaceson it, this might not count as a separator for those translators, andthat could cause odd formatting.=item *Older translators might add wording around an LE<lt>E<gt> link, so thatC<LE<lt>Foo::BarE<gt>> may become "the Foo::Bar manpage", for example.So you shouldn't write things like C<the LE<lt>fooE<gt>documentation>, if you want the translated document to read sensibly-- instead write C<the LE<lt>Foo::Bar|Foo::BarE<gt> documentation> orC<LE<lt>the Foo::Bar documentation|Foo::BarE<gt>>, to control how thelink comes out.=item *Going past the 70th column in a verbatim block might be ungracefullywrapped by some formatters.=back=head1 SEE ALSOL<perlpodspec>, L<perlsyn/"PODs: Embedded Documentation">,L<perlnewmod>, L<perldoc>, L<pod2html>, L<pod2man>, L<podchecker>.=head1 AUTHORLarry Wall, Sean M. Burke=cut
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?