1. Pod syntax
Pod can be divided into three kinds, ordinary paragraph, literal paragraph (verbatim Paragraph) and command paragraph.
The distinction between the three is very simple, to =pod|head1|cut|over, such as the beginning of the paragraph as a command paragraph, with a space or tab (\ t), such as indentation to start the paragraph as a literal paragraph, the rest is the ordinary paragraph.
[PHP]View PlainCopy
- =head1
- =head2
- =head3
- =head4
- This four indicator words produce the title of the specified level. Pod2html with its corresponding
[Plain]View PlainCopy
- =pod
- =cut
- =pod only tells the compiler that the pod document is starting, and =cut is the end of the pod document.
[Plain]View PlainCopy
- =over number Close
- =item SYMBOL Generation Bullet
- =back
- The three of them are connected together. =over must be followed by a =back, and there is at least one =item between the two, and there can be no =head1. 4.
[Plain]View PlainCopy
- Format code
- The format code can be used for all paragraphs except the literal paragraph, including the command paragraph.
- I<text>
- Text in italics, effect as text
- B<text>
- Text in bold, effect as text
- C<code>
- Pod2html with <code> surround.
- L<text|name/sec>
- Hyperlinks.
2. Use of Pod2usage in the package.
If you want to display pods in the Perl module, use the following
[Plain]View PlainCopy
- Use Pod::find QW (pod_where);
- Pod2usage (-input = Pod_where ({-inc = 1}, __package__));
- Where:-inc=>1 means Search @INC for the pod and also the Scriptdir __package__ represents the package file, if it is a::b A/b
- Pod_where returns a reference to the file handle, and the default value in Pod2usage is $ $, the current file instead of the package itself
Basic usage of pods in Perl.