Perl POD documentation
Perl can embed POD (Plain Old Documentation) documents in modules or scripts.
POD is a simple and easy-to-use markup language (markup language).
POD document usage rules:
Perl ignores documentation in POD. The example is as follows:POD document starts with =head1, =cut ends, =head1## Add a blank line before # and after =cut.
#!/usr/bin/perl print "Hello, World\n"; =head1 Hello, World 实例 这是一个 Perl 的简单实例。 =cut print "Hello, php\n";Execute the above program, the output result is:
Hello, World Hello, phpWe can also use "__END__" or "__DATA__" to "comment" out all the content after the line:
#!/usr/bin/perl print "Hello, World\n"; while(<DATA>){ print $_; } __END__ =head1 Hello, World 实例 这是一个 Perl 的简单实例。 print "Hello, php\n";Execute the above program, the output result is:
Hello, World =head1 Hello, World 实例 这是一个 Perl 的简单实例。 print "Hello, php\n";The following example does not read the POD document:
#!/usr/bin/perl print "Hello, World\n"; __END__ =head1 Hello, World 实例 这是一个 Perl 的简单实例。 print "Hello, php\n";Execute the above program, the output result is:
Hello, World
What is POD? Pod (Plain Old Documentation) is a simple and easy-to-use markup language (markup language), which is often used for document writing in perl programs and modules. Pod's converter can convert Pod into many formats, such as text, html, man, etc. Pod markup language contains three basic basic types: normal, original, and command.
Normal Paragraph: You can use formatting codes in normal paragraphs, such as boldface, italics, or code style, underlining, etc.
Original text paragraph: Original text paragraph, used for code blocks or other parts that do not require converter processing, and do not require paragraph rearrangement.
Command paragraph: Command paragraph acts on the entire document, usually used for title setting or list markup.
All command paragraphs (which are only one line long) start with "=", followed by an identifier. Subsequent text will be affected by this command. Now widely used commands include=pod (开始文档) =head1 标题文本 =head2 标题文本 =head3 标题文本 =head4 标题文本 =over 缩进空格数量 =item 前缀 =back (结束列表) =begin 文档格式 =end 结束文档格式 =for 格式文本 =encoding 编码类型 =cut (文档结束)
=begin html =encoding utf-8 =head1 php中文网 =cutThis code will be copied from the original text when pod2html is used. Use the pod2html command to execute and convert it into HTML code:
$ pod2html test.pod > test.htmlOpen test.html in the browser, the link part is the index, the display is as follows:The following example writes HTML directly into the POD document:
=begin html =encoding utf-8 <h1>php中文网</h1> <p> www.php.cn </p> =end htmlpod2html will copy the original text of this code. Use the pod2html command to execute and convert it into HTML code:
$ pod2html test.pod > test.htmlOpen test.html in the browser, the link part is the index, the display is as follows: